objective-cipadipad-mini

CGrectMake width automatic on different devices


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?


Solution

  • This will give you width in points:

    [UIScreen mainScreen].applicationFrame.width
    

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