简体   繁体   中英

Default space between UIBarButtonItems on iPhone

I have a UINavigationBar on which I have put UIBarButtonItems . iPhone by default puts a space of 10 between the button items. I want to know what variable denotes this space? To be more clear - I would like to know the variable that can get me the space between the UIBarButtonItems on my UINavigationBar .

Thanks

The published approach for doing this on a toolBar or navBar in any version of the SDK below iOS 6 is via something like this.

b = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

You use the UIBarButtonSystemItemFlexibleSpace style property to add a dummy button. You don't have control over specific dimensions and the system will space it out for you. Works perfectly fine in most cases.

Or if you need more precise control you have to create a custom button.

So, you can use one of the above approaches NOW, and I DO suggest you try out the FlexibleSpace option if your not familiar with it.

Or you can wait for iOS 6, that version of the SDK has some other ways to do what you want, but we are under NDA until that is released. You can either log into the iPhone Developer portal and look up the documents yourself or wait until iOS 6 is released.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM