I have tabBarController with 6 views. As default tabBarController load first view, I need to load view #6 at my application start, so in my tabBarController I add to viewW
I change order of items in my tabBarController in storyboard, change numbers of views in code and everything works. Thanks to all.
It looks like You added [self.tabBarController setSelectedIndex:6];
to viewWillAppear
instead of viewDidLoad
. There is no viewWillLoad there.
Do something like this in the viewDidAppear method of your tab bar controller, so it only sets the selectedIndex when the app starts up:
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
static BOOL isFirst = YES;
if (isFirst) {
[self setSelectedIndex:6];
isFirst = NO;
}
}