开发者

iphone application for tabbar

How can i define someViewIWantToDisableOtherFor and anotherViewIWantDisabled in the following code?

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 &&             
         dontAllowSelecti开发者_如何学运维on == viewController)   
    {
        return NO;
    }
    currentlySelected = viewController;

    if (currentlySelected == someViewIWantToDisableOtherFor)
    {
        dontAllowSelection = anotherViewIWantDisabled; 
    }
    else
    {
        dontAllowSelection = nil; 
    }

    return YES;
}


Not enough information. You're asking how to get pointers to two views, but those views could come from anywhere. The view controller might have them already as IBOutlets, or it might find them using their tag value, or the user might touch one or both of them...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜