I created a UIViewController and I added a UIBarButtonItem to represent a back button and its not appearing when I run my app, just a blank screen.
Here is a screen shot of my scene
and here is the list of items in my scene:
I also connected the bar button item to my header file:
@property (strong, nonatomic) IBOutlet UIBarButtonItem *BackButtonItem;
still not appearing
The button is appearing as you can see the item button on the lower left hand of your screen.
To create a custom back button I would embed a Navigation Controller inside of your View Controller. Then inside your .m file you can do the following, if you want a custom back button with a custom image.
- (void)viewDidLoad
{
UIBarButtonItem *addCustomButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"YourImage.png"] style:UIBarButtonItemStylePlain target:self action:@selector(yourSelector:)];
self.navigationItem.leftBarButtonItem = @[addCustomButton];
}
To add a back button in view controller through storyboard, follow the below steps:-
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.