objective c - I can't understand UIScrollView behavior -
i've read lot of documentation still don't understand how uiscrollview works.
i have example use uinavigationviewcontroller status bar (little top bar wifi, battery, etc., icons) , navigation bar (with "back" button).
as first subview of uinavigatioviewcontroller's main view have uiscrollview. inside have created several subviews make it's contents size 500 points.
in "viewdidload" method set scroll view's "contentsize" equals 500. doens't scroll down show last subview.
i read should add points "contentinset" because of "bars". don't know why. isn't scroll view inside main view correctly framed? why need take "bars" account?
anyway, read should 64 points (44 navigation bar + 20 status bar). doesn't work.
the "magic" number (at least me) 84 points. must add quantity content size (584) or use as:
self.scrollview.contentinset=uiedgeinsetsmake(0.0,0.0,84.0,0.0); // @ bottom!!
i'm confused this. give hand on understanding it?
thanks.
self.scrollview.contentinset=uiedgeinsetsmake(0.0,0.0,84.0,0.0);
update
i have seen because made scrollview size bigger in interface builder in order add new elements beyond normal small visible size, had "frame" size near 500 points.
i set frame size 416 (just fit , cover visible space) , content size of 500 points (without additional inset values) scrolls perfectly.
but still don't understand previous behavior...
Comments
Post a Comment