Michal
Michal

Reputation: 15669

Making scrollable view when changed to landscape

How can I make a view scrollable when changed to landscape mode? e.g. I have an app in portrait mode, lots of information involved. I hape preset all struts and springs, but I still need some space in the bottom, so I was thinking enabling scrolling function, but how could I accomplish that?

Upvotes: 2

Views: 1666

Answers (1)

Rui Peres
Rui Peres

Reputation: 25917

The scroll is enabled when the content size is bigger than the frame of the scroll. Try the following:

myScroll.contentSize=CGSizeMake(100.0f,200.0f);
myScroll.frame=CGRect(0.0f,0.0f,100.0f,100.0f);

This will make you scroll vertically, because the height of the content size is bigger than the height of the frame. While this would make you scroll horizontally:

myScroll.contentSize=CGSizeMake(100.0f,200.0f);
myScroll.frame=CGRect(0.0f,0.0f,200.0f,200.0f);

Either way, you when your screen rotates, you should handle your logic according that what I explain.

Upvotes: 1

Related Questions