سؤال

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?

هل كانت مفيدة؟

المحلول

This will give you width in points:

[UIScreen mainScreen].applicationFrame.width

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

نصائح أخرى

You can use autoresizingMask:

navControl.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top