Is it possible to use UIScrollView
with Paging dynamically
Exemple : i had a NSMutableArray
with 3 objects, i can create my UIScrollView开发者_JS百科
with Paging for three objects but i would like to add a fourth object. Is it possible ? And do i have to reboot app?
Thanks for listening and sorry for my bad english ;)
Tom
Have a look at Multiple virtual pages in a UIScrollView with just 2 child views or the example App PageControl by Apple.
That's no problem, you just add more subviews to the scroll view with addSubview:
on the UIScrollView
object. Don't forget to position the subview correctly (setting its frame) and growing the contentSize
of the scroll view so the scrollable area is extended. Since you're paging, the content size should be a multiple of the scroll view's bounds.
You can add new views in the UIScrollView without rebooting the application.
So let me understand this here. You want to have a UIScrollView and you want to programatically add pages?
Sure you can do this, just create a new UIView/UIImageView and add it as a subview of the UIScrollView. Make sure you specify it's frame coordinates though.
You can add objects to your NSMutableArray alongside this so you'll always know information such as 'count' and index of certain items.
If paging is enabled then you'll be good to go.
精彩评论