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)];
精彩评论