IPhone/IPad: How to get screen width programmatically?

前端 未结 7 515
囚心锁ツ
囚心锁ツ 2020-11-29 00:36

Hi I\'m wondering if there\'s a way to get the width programmatically.

I\'m looking for something general enough to accomodate iphone 3gs, iphone 4, ipad. Also, the

相关标签:
7条回答
  • 2020-11-29 01:18
    CGRect screen = [[UIScreen mainScreen] bounds];
    CGFloat width = CGRectGetWidth(screen);
    //Bonus height.
    CGFloat height = CGRectGetHeight(screen);
    
    0 讨论(0)
提交回复
热议问题