Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making UIView Scrollable without UIScrollView

Basically, what I'm trying to do is make the normal UIView scrollable (no UIScrollView). When my app changes orientation from portrait to landscape, the content that falls below the bottom boundary becomes inaccessible. When I tried to use UIScrollView, I still couldn't access the content below the bottom boundary and the ScrollView didn't resize to follow the constraints I set for it.

Can someone help me make a UIView scrollable?

like image 818
Crimson1222 Avatar asked May 26 '15 19:05

Crimson1222


2 Answers

You can make a UIView scrollable but not in a conventional way. As @colinrf said, that's what a UIScrollView is for. But, for example, you can make a UIView twice the height of the screen, then subtract and add the Y value of the Rect in accordance with the UITouch movements. For instance, if the touch location (delta if you want) is moving negative from middle of the screen to the top, move the Y value negatively as well. You can do it by UIGuestureSwipe too.

like image 52
iSkore Avatar answered Oct 25 '22 02:10

iSkore


You cannot make a UIView scrollable. That's what UIScrollView is for. However if you are using storyboards you can try to add constraints to the view so when you rotate the device the content remains inside the viewable area. Sounds like you already have some constraints setup so I would just play around with them. Sometimes it can take some tweaking to get them right.

like image 35
colinrf Avatar answered Oct 25 '22 02:10

colinrf