0
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
[[NSNotificationCenter defaultCenter] postNotificationName:ListOrMapAddReloadButton object:self]; //Add nearby buttons
}
В одном UIViewController
здесь последовательностьПочему иногда viewDidLoad вызывается первым, а иногда называется последним?
viewDidload
дозвонились[[NSNotificationCenter defaultCenter] postNotificationName:ListOrMapAddReloadButton object:self];
И потому, что уведомление настроить вызывается в viewDidLoad, я как бы нужно viewDidLoad называться прежде чем «
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
`
Как я могу добиться этого?
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addReloadButton) name:ListOrMapAddReloadButton object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addNearbyButton) name:ListOrMapAddNearbyButton object:nil];
Я хочу, чтобы назвать только один раз, а затем удаляются при dealloc. Поэтому я положил его на viewdidload. Я считаю, что viewdidload является подходящей «парой» для dealloc. –
На самом деле самой подходящей «парой» для 'dealloc' будет' init' ... – fumoboy007