title: iPhone Navigation Bar Title text color do not change in function viewWillAppear() or viewWillDisappear in iOS 11
body: <p>The error did not happen in iOS 10.
  The default of title text color is black color, when navigate to new screen (2) i change the title text color to pink color in viewWillAppear(), and in viewWillDisappear i change this to default color.
  The logic is ok with iOS 10, but with iOS 11 the first screen that have the bar title color is pink color (the expected is default color)</p>
  
  <p>In addition : when add logic change color in viewWillAppear() (the color do not change in this situation) however <strong>this work in viewDidAppear()</strong>,but there is error, the title is blink change color when back from screen 2 to screen 1</p>
  
  <p>source in screen 2 (work for iOS 10):</p>
  
  <pre><code>#define NAVBAR_TITLE_FONT_ATTR @{ UITextAttributeFont : [UIFont boldSystemFontOfSize:19], UITextAttributeTextColor: [UIColor colorWithRed:9/255.0 green:34/255.0 blue:83/255.0 alpha:1]}
  #define NAVBAR_TINT_COLOR [UIColor colorWithRed:97/255.0 green:113/255.0 blue:146/255.0 alpha:1]
  #define NAVBAR_BG_COLOR [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1]
  #define LIGHT_BLUE_COLOR [UIColor colorWithRed:0.04 green:0.13 blue:0.33 alpha:1.0]
  
  
  -(void)viewWillAppear:(BOOL)animated {
  
      [super viewWillAppear:animated];
      [self.navigationController.navigationBar setBackgroundImage:[UIImage new]                                              forBarMetrics:UIBarMetricsDefault];
      self.navigationController.navigationBar.shadowImage = [UIImage new];
      self.navigationController.navigationBar.translucent = YES;
      self.navigationController.view.backgroundColor = [UIColor clearColor];
      textColor = [UIColor pinkColor] 
      self.navigationController.navigationBar.tintColor = textColor;
      self.navigationController.navigationBar.titleTextAttributes =  [NSDictionary dictionaryWithObjectsAndKeys:
                                                                      textColor, NSForegroundColorAttributeName,
                                                                      [UIFont boldSystemFontOfSize:19], NSFontAttributeName,nil];
  
  }
  
  -(void)viewWillDisappear:(BOOL)animated {
  
      [super viewWillDisappear:animated];
  
      self.navigationController.navigationBar.tintColor = NAVBAR_TINT_COLOR;
      self.navigationController.navigationBar.barTintColor = NAVBAR_BG_COLOR;
      self.navigationController.navigationBar.translucent = NO;
      [self.navigationController.navigationBar setTitleTextAttributes:NAVBAR_TITLE_FONT_ATTR];
      [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/XATSz.jpg" alt="screen 1"></p>
  
  <p><img src="https://i.stack.imgur.com/qTiIJ.png" alt="screen 2"></p>
  
  <p><img src="https://i.stack.imgur.com/CNnYQ.jpg" alt="come back screen 1"></p>
  
  <p>The correct answer is :</p>
  
  <pre><code>- (void)willMoveToParentViewController:(UIViewController *)parent {
  
      if (!parent) {
          self.navigationController.navigationBar.titleTextAttributes =  @{
                                                                           NSForegroundColorAttributeName: [UIColor blackColor]
                                                                           };
  
   }
  
  }
  </code></pre>
  
  <p>thanks @Phu Nguyen</p>
  
  <p><a href="https://stackoverflow.com/questions/8228411/detecting-when-the-back-button-is-pressed-on-a-navbar">Detecting when the &#39;back&#39; button is pressed on a navbar</a></p>