我想使用shouldSelectViewController来停止权限选择选定的particuler标签栏后的标签栏。那我该怎么用呢以下代码无效。
- (BOOL)tabBarController:(UITabBarController *)tabBarControllers
shouldSelectViewController:(UIViewController *)viewController
{
UIViewController *vcnt= [tabBarControllers.selectedViewController];
if(vcnt==viewController)
{
return NO;
}else
{
return YES;
}
}
答案 0 :(得分:1)
你想要这样的东西:
- (BOOL)tabBarController:(UITabBarController *)tabBarControllers
shouldSelectViewController:(UIViewController *)viewController
{
if(alreadySelectedSpecificTab)
{
if([viewController isEqual:viewControllerNotToAllow])
return NO;
}
return YES;
}