开发者

UIView frame larger than iPhone's screen

I have made a new iPhone View-based project in XCode, and I have a look at the xib generated, with the name myAppViewController.xib. In that xib, the generated view's frame looks like this: { x = 160, y = 230, w = 320, h = 460 } this view is supposed to fill the entire screen, excluding the status bar. I would expect the view's frame to look like this: { x = 0, y = 0, w = 240, y = 300 } for the older iPhones, and { x = 0, y = 0, w = 480, h = 600 }开发者_如何学编程 for the retina display. However, I get those weird values above. Can anyone please explain to me what is happening here, it is ruining some of my drawing code in my other project (the area to draw is based off of the frame of the view).


Retina display doesn't actually increase the point size of the view.
When Apple introduced it, it made a difference between points and pixels. Retina display has more pixels, but the same amount of points.
Everything in your code related to UIKit will generally be in points, so no changes are needed there, a view of 100x100 will still be that size.

I don't understand really your question but the frame value can be modified by the bounds property and the center property... so check if you're not modifying those.


Frame rects are as such:

CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)

the screen width is 320px wide by 480px tall. the status bar is 20px. thus the rect you would want is:

CGRectMake(0,0,320,460)

regardless of retina or not, the device will convert up as needed.


Coordinates are in points, not pixels. The coordinate system is 320 X 480, regardless of the resolution of the screen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜