ios - uiscrollview's unusual contentsize property -
i quite new ios application development.
i working uiscrollview
, found strange behavior. hope explain me.
i tried 2 methods , found outputs different.
1). uiscrollview
added view
in interface builder, , view (uiview)
added scrollview
earlier. set view's bounds manually in ib, , set scrollview
's content size
in class file.
observation : scrollview
doesn't scroll
setcontentsize
, rather takes unusual content size
, independent of else, own bounds.
2). same uiscrollview
again added in interface builder, view
added time programmatically.
observation : time works out quite good.
i don't understand have gone wrong.
can explain , elaborate
i'm not sure problem is, if want able add views uiscrollview in ib, create uiscrollview subclass , this:
- (void)awakefromnib { [super awakefromnib]; cgrect bounds = cgrectzero; (uiview* view in self.subviews) { bounds = cgrectunion(bounds, view.frame); } [self setcontentsize:bounds.size]; }
Comments
Post a Comment