문제

basically I want to know if the view controller I'm in is the root view controller or not.

If its not I want to put a button in the nav bar that says "back" (as if it were a proper back button - this bit I know how to do).

Before you ask, I have removed all the titles from my view controllers - I didn't want them to show up on my navigation bar... its very complicated - but this means that when I go through my navigation stack none of the pushed view controllers have a back button. :/

Thanks Tom

도움이 되었습니까?

해결책

if ( self != [self.navigationController.viewControllers objectAtIndex:0] )
{
   // Put Back button in navigation bar
}

다른 팁

You can also try:

if (self.navigationController.viewControllers.count == 1) {
    NSLog(@"self is RootViewController");
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top