UIScrollView with UIImageView gesture click only work on first visible images - swift

I have UIScrollView and I add few UIImageView, it's comment ViewController and click on images only work for first two images or for only images which are visible when scroll Y = 0. Even if image is half visible when scroll Y = 0 then first half of image click works and second half when you try to click nothing happen. Any explanation?

I resolve it by implementing touch position on scroll and I handle click on image if it's clicked on image ...

Related

Scrolling whole Image from UICollectionView

I have a UICollectionView with UIImage and when i tap on the Cell it´s comes a whole UIImage. I want to Slider Right or Left on the whole Image then show the next UIImage from the UICollectionView like a Photo Gallery. How can i make that ? Thanks for Help.
UICollectionView and Whole UIImage
You could use a UIScrollView for that, large enough to carry 3 images, the current one, the previous one and the next one. The largest is in the middle. The scrollview scrolls horizontally. Then you react on scrolling (and gestures) and when the user scrolls to right or left then you scroll your scrollview to the middle again and realign the 3 images by discarding one and adding a new one dependig on the direction the user scrolled.

IOS UIScrollView: Cannot scroll until the end of the content

I am trying to generate a scroll controller in a window with the UIScrollView class, which will contain numerous UIButtons, placed vertically. I set the size of the scroll view equal to the current view controller's root view, so that the scroll view covers the entire visible window. Then I generate the UIButtons I am going to add to the scroll view: I add each UIButton just in the below of the previous UIButton and I add the height of the current UIButton to a variable called "totalContentHeight". Finally, I set the height of the contentSize of the scroll view to this value, in the following line of code:
self.scrollViewForNewsButtons.contentSize = CGSizeMake(self.view.frame.size.width, totalContentHeight);
totalContentHeight is equal to numOfButtons*eachButtonsHeight after I add all the buttons to the scroll view.
The problem is, in the simulator, when I run the app and scroll until the end of the last button and release the mouse, the last two buttons bounces back such that they lie outside of the visible window. It is somewhat hard to express with mere words, so here are the images:
1)This is what I get when I scrolled until the end of the content and held the content at the last possible position it could be pushed:
2)This is what I get after I released the mouse and the scroll view bounced back to its final position:
As you can see, the last two buttons are drawn outside of the visible area. It is like the scroll view's area covers the whole window plus the button area of the IPhone. I could not find a reasonable explanation for this. Am I setting the area size wrong or am I missing something else?
just set content size with calculation with your total button and its height...For Ex..
float yheight = totalButton * yourButtonHeight;
[yourScrollView setContentSize:CGSizeMake(320, yheight + 44)];
try this code...
And if you set the scrollview frame size the same as
self.view.bounds

UIImageView Tap Gesture Sensitivity

I have an ImageView object on my screen. When I tap it, it displays an info in a bubble style view. The problem is the imageview is very thin and small, it does not pick the tap gesture. Any suggestions about how to increase the sensitivity? Any solutions?
You need to increase the size of the screen area that is responding to the tap. So you could make the imge view bigger (but set the content mode to center so the image isn't stretched).

how to implement code for swapping the images?

hi all how to implement code for swapping the images if a row consists 10 images whenever we want swap the image by selecting the image clicking on that so help me to solve the problem in iphone
Asuming that images are in scrollview
First of all set image on uibutton and add target to that button to handle button click.
on button click set content offset of scrollview like this
[scrollview setContentOffset:CGPointMake(btn.frame.origin.x, 0) animated:YES];

rotation of images in UIScrollView

resizing images inside UIScrollView when rotating the iphone.
I have a series of images placed on the UIScrollView (some images are placed one on top of the other). When I rotate the scrollview at some page, the topmost image on the hierarchy is expected to rotate which happens but the image goes to the first page of the scrollView. Any help on what could be going wrong would be appreciated.
thanks
DKV
I think the imageView which is misbehaving w.r.t to its frame is not added into correct super view. I think you should check that all imageView are added onto scrollView (if you want to show one imageView above another imageView make frame of both the imageView same, avoid adding one imageView onto another imageView).