简体   繁体   中英

need help about add navigationItem

替代文字

As you see in the images, the top picture is created automatically when navigation controller is pushed

If I try to create one like this it will appear like the bottom picture.

How can I programmatically create a Back Button like the top picture?

Here is my code to create the Done button

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(backtohome)];
UIBarButtonItem *theBackButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
                                                                  style:UIBarButtonItemStylePlain target:self action:nil]; 
self.navigationItem.backBarButtonItem = theBackButton;
[theBackButton release];

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