开发者

How to get the frame size (orientation dependent) in Objective-C?

开发者 https://www.devze.com 2023-03-14 22:45 出处:网络
I used [[UIScreen mainScreen] bounds] to get the frame size in Objective-C, for example 1024x768 in iPad.

I used [[UIScreen mainScreen] bounds] to get the frame size in Objective-C, for example 1024x768 in iPad.

However, when I switch the screen orientation, like from portrait to landscape, [[UIScreen mainScreen] bounds] still returns the same value.

How to get the frame size (orientation dep开发者_StackOverflow社区endent) ? (For example, 1024x768 when in portrait and 768x1024 in landscape)

Thanks


Update: problem solved.


Try with

CGRect rect = [UIScreen mainScreen].applicationFrame ;

it will return you frame of application screen area in points (i.e. entire screen minus status bar if visible)

0

精彩评论

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