Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道如何设置导航栏之类的宽度,CGRectMake(0,0,748,100)例如用于自定义导航栏的 ipad mini,但是 ipad 宽度的分辨率大约是该宽度的两倍,有没有一种方法可以在任一设备上工作?
CGRectMake(0,0,748,100)
这将为您提供点宽度:
[UIScreen mainScreen].applicationFrame.width
你可以得到像素的宽度乘以它[UIScreen mainScreen].scale
[UIScreen mainScreen].scale
您可以使用 autoresizingMask:
navControl.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;