UINavigationController standard back button strange behavior (hiding without fading) - uinavigationcontroller

I do regular pushViewController, then tap back button (all controlls native). The first time I do it all is fine, but further times animation popping to previous controller is strange - back button dissapeares without fade animation. What can be wrong?
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = YES;
[self.navigationController pushViewController:browser animated:YES];

It was an issue of MWPhotoBrowser. It creates new back button, the same as standard, but its behavior different.

Related

UINavigationController's setViewControllers adds back button in IOS10

Noticed strange thing: when you replace view controllers stack in UINavigationController using setViewControllers:animated: back button is displayed during animation and disappears when animation completes. Found only in iOS10 (both device and simulator), iOS8 and 9 work correctly (no back button). Has anybody faced this issue?
Same Problem here but even with animated:false.
I also realized that the memory goes up when I keep repeating. Do they stay in background?
My code:
firstNavigationViewController.setViewControllers([firstRootViewController, secondViewController], animated: false)//
UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController = firstNavigationViewController
My workaround is to set the following in viewWillAppear:
navigationController?.navigationBar.backItem?.title = "Protokoll"

ios7 new pan gesture to go back in navigation stack does not clear tableview selection

I have a Notes-like app: uitableviewcontroller showing up individual notes by pushing them onto navigation stack). And I decided to use an ios7 Back button and a pan gesture recognizer coming with it.
My only modification is removing text from the button by setting navigationItem title of the from-controller to an empty string before pushing the detail-view-controller, as it is advised at https://stackoverflow.com/questions/18870128/ios-7-navigation-bar-custom-back-button-without-title
The button itself works just fine, but when I am going back from my note to the notes table view by means of the pan gesture, tableview selection is not cleaned! The row of the note I've just transitioned from is still shown as a selected one.
Any ideas what could be wrong here?
I've checked the standard Notes app and it works like a charm.
This answer did help me: https://stackoverflow.com/questions/897071/iphone-uitableview-cells-stay-selected
- (void) viewWillAppear:(BOOL)animated {
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
[super viewWillAppear:animated];
}
At least for the cases we were seeing this happen, it seems to be fixed in iOS 7.0.4. (We've actually noticed that a number of glitches with the back gesture have been fixed during the 7.0.x releases.)

How to create a multiview application in xcode 4 using UINavigation Controller without a TableView?

I'm new to iPhone development. I would like to understand how to create a multiview application without TableView. The brief description of the program is: it includes three views, each one has a button. When user taps button it takes him to the next screen going in a circle. 1-2.2-3.3-1.
Two things are most important:
How to get rid of TableView and use NavigationController without it?
How to get back from the third view to the first one?
If you're just using UINavigationController with UIView's it is pretty easy. Have a view or button on view 1, that intercepts the touch action.
Shows binding a touch action to the button on your view 1
[button2 addTarget:self action:#selector(button2Pressed:) forControlEvents:UIControlEventTouchUpInside];
This shows how the method pushes a new controller to the navigation. You can do this on view 2 to take you to view 3 as well.
-(void)button2Pressed:(id)sender {
UIView view2 = [[[UIView alloc] init] autorelease];
[self.navigationController pushViewController:view2 animated:YES];
}
Finally, if you want to get back to view 1
[self.navigationController popToRootViewControllerAnimated:YES];
The best way to learn about the various options is to check out the documentation UINavigationController.

Navigation Controller Back button to go to the screen before the previous screen

I'm wondering whether it's possible to go back to 2 previous page using navigation controller button. Right now, I've custom made the button using this code
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:mainLib.navCountryTitle
style:UIBarButtonItemStyleBordered
target:self
action:#selector(handleBack:)];
And on 'handleback' method, I called this line
[self.navigationController popViewControllerAnimated:YES];
So in this case it will go to the previous screen. However I want to go to the screen before the previous screen.
I know that i can call that screen straight away, but I wouldn't want to do that because in every screen I have a back button which supposed to go to its previous screen.
You can pop to particular viewcontroller using its pushing index. If you know the syntax than you can do that like
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:indexOfViewController] animated:YES];
I believe, In your case it would be 1st Index. Though you can again change index and check.
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
Here self.navigationController.viewControllers is the array of the all the ViewControllers pushed.
Hope it helps.

Substitution of detail view controller does not cause viewWillAppear to be called

I'm porting my iPhone app to iPad. On iPhone I select row in the table, and after that the next view controller is pushed to the top of navigationController (now navigation is performed on the left part of split view controller). For iPad i modified the code this way:
if (deviceIsIPad())
{
UISplitViewController *svc = (UISplitViewController *)[self findNearestParentOfClass:[UISplitViewController class]];
svc.viewControllers = [NSArray arrayWithObjects:[svc.viewControllers objectAtIndex:0],
nextViewController,
nil];
}
else
[self.navigationController pushViewController:nextViewController animated:YES];
There are no problem at iPhone code (when controller is pushed to navigation controller), but on iPad viewWillAppear: is not called (viewDidLoad is called however), while I have a reason to perform some customization right in viewWillAppear:. Why is it not called, and what should I do to force it to be called?
Much thanks in advance!
Not exactly sure what you're trying to do here but simply initializing a splitview controller and adding controllers to it does not force views to appear. You have to add the splitview controller's views to the window.
Here is the code from the Xcode Splitview template's app delegate's applicationDidFinishLaunching:
splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, detailViewController, nil];
splitViewController.delegate = detailViewController;
NSLog(#"master=%#",splitViewController.viewControllers);
// Add the split view controller's view to the window and display.
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];
The views in the navigation controller appear because it is already attached to the window and displaying the view of one of its controlled controllers.
Edit:
From Comments:
All initialization code you are quoted
here is already performed. Now, let's
assume one have a table on the left
controller, then he select another row
there, and want to replace right
controller with another one.
splitViewController.view is added on
the window фдкуфвн, because some GUI
elements initialized in viewDidLoad,
are properly presented on view
It sounds like your problem arises because the detail (right-side) view of a splitview controller is always visible i.e. it only appears i.e calls viewWillAppear, once immediately after first being loaded. There is no point at which the detail side has no view present. I'm not sure what entirely swapping out viewControllers of the splitview will do.
If you want to change the detail view on the fly. You need to put a navigation controller in the right side and then push and pop view-controllers in that nav in response to events in the right side controller.
Look at how the iPad iPod app works. You have a leftside view of playlist and on the right side, a list of all the songs in the playlist. Selecting a song pushes a song detail view on top the list of songs.

Resources