-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
[[NSNotificationCenter defaultCenter] postNotificationName:ListOrMapAddReloadButton object:self]; //Add nearby buttons
}
其中一个UIViewController
是顺序
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];