Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setRightBarButtonItems iOS5 not working

I am using the new API for UINavigationItem setRightBarButtonItems like this:

UIBarButtonItem *buttonSettings = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"settings.png"] 
                                                                style:UIBarButtonItemStylePlain 
                                                               target:self 
                                                               action:@selector(showSettings:)];
UIBarButtonItem *buttonLogout = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPageCurl target:self action:@selector(showSettings:)];


[[self navigationItem] setRightBarButtonItems:[NSArray arrayWithObjects:buttonLogout, buttonSettings, nil]];

But, only 1 button (settings) is appearing and logout button is not appearing at all. What am I doing wrong? Thanks

like image 407
0xSina Avatar asked Feb 07 '26 02:02

0xSina


1 Answers

You are not allowed to do it:

UIBarButtonSystemItemPageCurl The system page curl button. This bar button image can be used only for bar button items placed on toolbars. Available in iOS 4.0 and later. Declared in UIBarButtonItem.h.

like image 96
A-Live Avatar answered Feb 12 '26 05:02

A-Live



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!