xcode - ScrollView offsets when superview is setframe?! (iphone) -
so have view , scroll view inside view. call a
[view setframe:cgrectmake(55,70,260,420)];
i put
nslog(@"%f %f",scrollview.frame.origin.x, scrollview.frame.origin.y);
before , after setframe , reads 6,112 , 6,172. 112 correct, have no idea 60 comes from. searched 60 in implementation file, , there nothing affect y @ all. there rule doing setframe when there view inside view?
thanks
if take @ uiview
reference, frame
property states
frame
the frame rectangle, describes view’s location , size in superview’s coordinate system.
@property(nonatomic) cgrect frame
discussion
this rectangle defines size , position of view in superview’s coordinate system. use rectangle during layout operations size , position view. setting property changes point specified center property , size in bounds rectangle accordingly. coordinates of frame rectangle specified in points.
so guess when nslog
frame scrollview displayed based on coordinates of superview. second nslog
shows different because superview's coordinate system has changed.
Comments
Post a Comment