Colleagues noticed that in iOS10, when you swipe back and then cancel halfway, the navigation bar will have three extra dots

Solutions:

Add a few lines of code to the viewWillAppear: method and set the title to an empty string:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    if(@ the available (iOS 11.0. *)) {self. NavigationItem. HidesBackButton = YES; }else {
        self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.hidesBackButton = YES; }}Copy the code

Reason exploration:

Check the next layer, obviously is the system default back button: UINavigationBar – > UINavigationItemButtonView – > UILabel

See backBarButtonItem (UINavigationItemButtonView) wide and high is 0, the three points is due to internal UILabel, because of the high wide enough so shows… The label word is the title of the previous controller automatically obtained by the system, so instead of using the backBarButtonItem created by the system, you can create a label without the title

# # # # # written some articles on the inside is directly determine UINavigationItemButtonView class type and rough hide away, feeling is not the best solution

Knowledge:

  1. The backBarButtonItem displayed by the current controller is from the previous controller; So you see that the label above shows < Password Management >, which is the last page on the stack for < Change login password >
  2. CustomView inbackBarButtonItemIs not effective

System comment: When this property is nil, the navigation item uses the value in its title property to create the appropriate back button.