Strange behavior of NavigationBar after multiple push and pop with animation NO. iOS7

ios, popviewcontroller, pushviewcontroller, uinavigationbar, uinavigationcontroller

Solution

★☆★ SOLVED ★☆★

Reason for problem

Doing push or pop inside -(void)viewDidAppear:(BOOL)animated method makes navigation stack unstable.

Solution

Create separate method for push or pop related process and call that method from another view controller (avoid push or pop inside -(void)viewDidAppear:(BOOL)animated)

After push operation call method [self.navigationController.view layoutSubviews]; which lays out subviews.

Problem

Problem while multiple pop and push operation performed on UINavigationController programmatically with animation NO. ( iOS7 iPhone Only ) Source Code https://github.com/abhishek9284/NavigationBarTest To understand problem consider following view tree. ( I use UITableViewController in my application ) Right click and select open image in new tab to see large image. Bug Info Right click and select open image in new tab to see large image. Bug/Problem occurs while performing following navigations. - Push one by one view manually and goto D view. (PUSH : Root > Alphabets > A > B > C > D) - Pop multiple views at once programmatically using popToViewController and go back to Root view. (POP : Root < Alphabets < A < B < C < D) - Push programmatically and goto 2 view. (PUSH : Root > Numbers > 1 > 2) in above step 2 and 3 pop and push done programmatically with animation NO, which makes UINavigationBar back button and title very strange. NOTE : Above problem occurs only in iOS 7 & work perfectly in iOS 6.

Original source