I’m having trouble setting a custom back button. Below is the current code I’m using in the parent ViewController in viewDidLoad:
UIButton *custBackButton = [[UIButton alloc] init];
[custBackButton setBackgroundImage:[UIImage imageNamed:@"back_btn.png"] forState:UIControlStateNormal];
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:custBackButton];
I can get the below code to work as a test:
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Test" style:UIBarButtonItemStyleBordered target:nil action:nil];
Can anyone give me a pointer or two with what I’m doing wrong for the first example?
Thank you,
don not use self.navigationItem.backbarbutton….use self.navigationItem.leftbarbutton….it will work….and before that make self.backbarbutton=nil….to remove it, otherwise it will overlap…and this wont run ur custom button