ViewWillAppear not called in UITableViewController?

I have a couple of UITableViewController classes and I just noticed that these methods are not being called:

-(void)viewWillAppear:(BOOL)animated;
-(void)viewDidAppear:(BOOL)animated;

I read at http://discussions.apple.com/thread.jspa?threadID=1529769&tstart=0 that I myself would have to call these methods when I click the view dispatchers, but this is strange, since it works for anything other than UITableViewController.

Also makes this a bit of an issue when I need the UITableViewCell to unselect in the UIViewController that pressed the UITableViewController.

+3
source share
7 answers

- , - UITableViewController navController, , , . UITableViewControllers , - , "viewWill/Did/Appear/Disappear" . viewDidLoad viewDidUnload.

, viewController , (?) - , .

?

+4

, , , UINavigationController.

UINavigationController, UINavigationControllerDelegate? :

navigationController:willShowViewController:animated: navigationController:didShowViewController:animated: 

, navigationController: willShowViewController: : :

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
  if ([viewController isKindOfClass:[UITableViewController class]]) {
    [viewController viewWillAppear:animated];
  }
}

, , , viewWillAppear: .

+9

. UITableViewController UIViewController, .

viewWillAppear: viewDidAppear: , .

, ? , , NSLog(), , - .

0

. UIView IB, addSubview , UITableViewController.

TableViewController , viewWillAppear .

0

, , , . UINavigationController "viewWillAppear" , , .

, , Apple, UINavController , .

, UINavController , "viewWillAppear" , "viewDidAppear" .. .

, , Three20, "viewWillAppear" . TTTableViews, .

0
source

The same thing can happen if you use the UITabViewController. You need to force a call to viewWillAppear by either calling UITabViewControllerDelegate or UINavigationControllerDelegate

0
source

This explanation may help: http://www.mlsite.net/blog/?p=210

0
source

Source: https://habr.com/ru/post/1736334/


All Articles