tabbar的iphone应用程序

时间:2011-04-22 07:03:48

标签: iphone

我该如何定义? 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;
}

1 个答案:

答案 0 :(得分:0)

信息不足。你问的是如何获得两个视图的指针,但这些视图可能来自任何地方。视图控制器可能已将它们作为IBOutlets使用,或者它可能使用tag值找到它们,或者用户可能触摸其中一个或两个...