Unable to click on any part of the UIScrollView to scroll through the images. There is only a specific porition I can click on - iphone

I've some UIImages loaded into a UIScrollView.
However, when I try to scroll through these UIImages, I can only click on a specific area in the screen.
What is the property I should look out for to expand the "clickable area"? Such that I can click on any part of the scroll view to start scroll through the images.
Is there anything to do with content size of the scroll view?

Make sure that -userInteractionEnabled is NO for the views you add to your scroll view.
Update:
Set -clipsToBounds to YES and see whether the scrollview's frame is just too small and the content goes beyond the bounds of the view.

Related

Smooth Scrolling between Table/Collection View and the Scroll View

I am implementing a scroll view which consists of an image underneath it is a collection view.
What I want to do is a smooth scrolling between the page as if the collection view is just elements in the scroll view.
But what happens is the when I scroll, the collection view needs to be dragged twice to exit it or to enter it.
What I mean is that when the scroll view first appears there is an image and under it is collection view. when I scroll down if I touch the image, the scroll is done correctly, however, if I touch the view the image is still here and a small scroll is done then when I scroll again the scroll is done right and the collection view takes the whole screen
After that when I scroll upwards, the same happens a small scroll happens then I have to touch again to do the scroll right and show the image.
EDIT: This GIF shows would clarify what I mean :
https://im2.ezgif.com/tmp/ezgif-2-75ed33ccd665.gif
Edit: The best solution was to create a TableView/CollectionView header and and my header in it and scroll normally for the table/collection view.
Old solution
The solution as provided in a comment by #MayurKarmur was to disable the scrolling in the collection view and adding height to collection view according to its content.

Make Area Page-able

How Can I make the green area of the screen shot of my app be able to scroll with the paging animation and page indicators?I would like for me to add more icon-buttons to it with keeping the header the same size.
First you need a scroll view and your view has to be inside of the scroll view.
Then you need to enable paging on the scroll view
[scrollView setPagingEnabled:YES];
If the value of this property is YES, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is NO.
If you want to have page indicators you need to use UIPageControlwhich you will have to manage yourself as far as I know. You could always check after scrolling (see UIScrollViewDelegate ) which page you are on based on the contentOffset property of the scroll view.

How can i move images on touch event?

I have created a image gallery. I show all images from plist file in navigation view. When i open image in full view after that i have to back in navigation. But i want to move images in scrolling when image in fullview. After open image in full view i want to swap one by one next as well as previous...
Is there possible..??
Plz give me help about any kind..
Regards....
Yes thats possible, make your fullview a scrollview with its contentsize having the same width as your screen and its height being the combined height of its subviews (put at least two or 3 imageviews in the scrollview as subviews). You can add and remove UIImageviews as subviews of the uiscrollview as the user vertically pages through them. You will need to communicate with the navigation view what the table status is when your user returns to that view though so that everything matches up.

how do i work on a taller view in interface builder?

OK, so I am learning to use UIScrollView in interface builder. since the scrollView itself does not have any content, I created another view, the contentView, to hold my controls and scrollable content. into this view I place controls, labels, etc and then in my code i set the contentSize of the scrollView to the size of this contentView.
My question seems stunningly simple and so obvious that I must have missed something somewhere. when I created this XIB in IB I got your standard empty iPhone interface window. I dropped a scrollView on top of it, it took up the whole window. I dropped a view on top of that, it took up the whole scrollview. I added some controls, which so far I can still see inside the contentView rectangle in IB.
My question is how do I work on/add controls which lie outside of the visible part of the contentView in IB? LOL. it seems so simple, but i just don't get it. I can set the height of the content view or drag the rectangle to whatever I like (and indeed this is the whole point of having a scrollview) but the fixed UI window from IB won't expand so i can see the "offscreen" part of the contentView to add more controls. It's like it's just fixed at that size because that's the size of one iPhone screen and it won't let me make it any bigger/taller.
what did I do wrong?
-a
You need to turn off all simulated user interface elements (like the status bar) to be "undefined" except for size, which you select to be "Freeform" from the drop-down, and then you can set the view height using the Ruler tab to be whatever you like.
For example, here I've selected a photo view controller, and set the size in the right side bar to be "iPad Full Screen" - but I could also change that to "freeform" to set any height I wished.
First add a ViewController by any which way you prefer. Then in interface builder, click on the view controller Icon (on left). In the connections inspector click on the ruler icon "Show the size inspector". There will be option list for simulated size, change to "Freeform" and increase the height to any size you want. Hope this helps.
neeever mind. you drag the content view up so that some controls are offscreen and then add more controls/expand to the part you just made visible by moving the top stuff off the top. in effect, you physically scroll the contentView in IB by dragging it with the mouse. seems a smidge counterintuitive, but whatever.
Set simulated size to freeform for the the view controller to a large enough size that you can add in your controls
You don't have to create a view to place inside the scrollview if you don't want. In your case, it sounds like it doesn't make much sense.
As for the second part of your question, you can place items directly on the scrollview (it is a view afterall), as subviews. If you want them to be off screen, then just set their frame up to be at those particular x, y coordinates you want it to be at. You will have to ensure your scrollview's contentSize property is large enough though to house your entire content, this is what allows scrolling horizontally/vertically.
You probably want to do the offscreen elements programmaticly instead of using xibs.

How to make modal view scrollable?

I have a modal view with a textview and a button. When the keyboard is displayed it covers up some of my UI elements. I'd like my modal to be scrollable so that it can be viewed while the keyboard is displayed. How can I do this?
I've had the same question, and i've played with it a bit,
setting a UIScrollView is not enough, as in the inspector
you should 1st. increase it Hight, then in the attributes, check the following checkboxes:
Scrolling enabled, Bounce Scroll, always bounce vertically.
Edited: Forgot the most inportant thing:
in the size inspector, set the Buttom field (under content) to the size you wish, (960 is twice the regular size)
Use a UIScrollView instead of an ordinary UIView. You can disable scrolling when you don't want the user to be able to with:
[theView setScrollEnabled:NO];