The setup code inside viewWillAppear should only be performed once. Inside my app it happens that I push a view controller and when navigating back viewWillAppear is called again. This then causes all the pages to be setup again and the current index is reset.