我该如何定义? someViewIWantToDisableOtherFor和 以下代码中的anotherViewIWantDisabled?
id currentlySelected; //This will hold the address of the selected view
id dontAllowSelection; //This will hold the address of the Denied view
- (BOOL)tabBarController:(UITabBarController *)tabBarControllers shouldSelectViewController:(UIViewController *)viewController
{
if (dontAllowSelection != nil &&
dontAllowSelection == viewController)
{
return NO;
}
currentlySelected = viewController;
if (currentlySelected == someViewIWantToDisableOtherFor)
{
dontAllowSelection = anotherViewIWantDisabled;
}
else
{
dontAllowSelection = nil;
}
return YES;
}
答案 0 :(得分:0)
信息不足。你问的是如何获得两个视图的指针,但这些视图可能来自任何地方。视图控制器可能已将它们作为IBOutlets使用,或者它可能使用tag
值找到它们,或者用户可能触摸其中一个或两个...