CGrectMake width automatic on different devices

514 Views Asked by At

I know how to set the width of something like the navigation bar, for ipad mini CGRectMake(0,0,748,100) for example for a custom navigation bar, however the resolution for the ipads width is around double that, is there a way that will work on either device?

2

There are 2 best solutions below

0
On BEST ANSWER

This will give you width in points:

[UIScreen mainScreen].applicationFrame.width

You can get width in pixels multiplying it by [UIScreen mainScreen].scale

0
On

You can use autoresizingMask:

navControl.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;