开发者

Use UIScrollView in iPad

开发者 https://www.devze.com 2023-04-13 06:20 出处:网络
I want to use UIScrollView dynamically, means I am making a Picture gallery, now when there are many pictures that goes beyond the bounds of the screen then it should scroll down so that use can see t

I want to use UIScrollView dynamically, means I am making a Picture gallery, now when there are many pictures that goes beyond the bounds of the screen then it should scroll down so that use can see the other photos as well.

I know i have to use UISCrollView but until now i have seen that we开发者_JAVA百科 have to give the bounds of UIScrollView explicitly. So can you please tell me how the UIScrollView extends its scrolling according to the data in it. ??

Thanks


Create a scrollView in .xib file. And add the pictures in this scrollview programmatically. When you add any of the picture, According to picture gallery height you need to maintain the content size of your scrollview. So create a IBOutLet of your scrollView as "scrollView".

add thsese lines where you want to add the pictures view in scrollview:

CGFloat height = yourPicture view's height;
CGFloat width = yourPictureView's width
[scrollView setContentSize:CGSizeMake:(height, width)];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号