I have a reference to a "UIBarButtonItem", is there a way I can add a custom "Back Navigation Button" to that item when it is not part of a Navigation based view?
I can add a left button:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Custom Back"开发者_Python百科 style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)]; menuItem.backBarButtonItem = backButton; //This doesn't seem to work. menuItem.popOverNavigationItem.leftBarButtonItem = backButton; //This shows a normal button
So how could I make the leftmost button look like a back navigation button?
UPDATE: This other question answered the root of my problem that was leading me to try and do this non-standard UI setup:
iPad: Merge concept of SplitViewController and NavigationController in RootView?I think the correct way to set the back button is to set it for the view controller that you would be going back to. For example:
RootViewController > DetailViewController
If you want the back button to say "Custom Back" whilst you're on DetailViewController, you have to actually set RootViewController's back button to "Custom Back".
Hope that makes sense.
Having just struggled with this: I think the answer is “no.” You'll need a controller hierarchy.
精彩评论