2011-04-22 44 views
0

如何定义 someViewIWantToDisableOtherFor和 anotherViewIWantDisabled在下面的代码中?iphone应用程序的tabbar

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

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

相关问题