2011-04-22 81 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,或者它可能使用它們的值找到它們,或者用戶可能觸摸其中的一個或兩個...

相關問題