1
votes

I have used Interface Builder to draw a simple UI with a scrollview, in viewDidLoad I am reading off the x, y, width and height of scrollview's frame CGRect property like this:

    NSLog(@"x=%f,y=%f,w=%f,h=%f",self.detailScrollView.frame.origin.x,self.detailScrollView.frame.origin.y,self.detailScrollView.frame.size.width,self.detailScrollView.frame.size.height);

(offcourse previously properly @syntheized everything and I have correct IBOutlets etc..)

but when I look at the readoffs and compare them to the interface builder values I am little bit confused about the y coordinate, everything else (x,width,height) is OK.

This is the output from NSLog:

 2012-08-06 15:52:40.481 xxxxx[1471:207] x=20.000000,y=147.000000,w=280.000000,h=293.000000

But the actual values from the interface builder for the scrollview are: X=20 Y=59 Width=280 Height=293 (sorry I cannot post screencapture).

Any hints why the y value is offset by 88 ? (147 in NSLog minus 59 in interface builder) Thanks

1
You are not supposed to see at viewDidLoad the frame which will be displayed, that might be either the orientation change, autoresizing or something else that is not processed before viewDidLoad is called. - A-Live

1 Answers

1
votes

I had this issue and fixed it by changing the autosizing. I set both the inner and outer box and it worked for me.