How to change back button from text to image in UINavigationBar
-
18-09-2019 - |
Question
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
initWithImage:@"rGoBack"
style:UIBarButtonItemStylePlain
target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
I use this source. but It doesn't work. I don't know why not. please..
Solution
From the first glance:
initWithImage:@"rGoBack"
here UIImage
parameter required and NSString
is passed instead. Try writing something like:
initWithImage:[UIImage imageNamed:@"rGoBack.png"]; // or whatever image name you have
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow