tabbar的iphone应用程序
如何在中定义和检查AlreadySelectedSpecific选项卡和viewControllerNotToAllow 我的申请书。谁给我举个例子 实际上我想做点什么。喜欢当选择了第二个选项卡时,如果我们选择了“第二个选项卡”,则此时不选择“第二个选项卡”,只选择“重新制作”选项卡 这就是我使用以下代码的原因 请回复tabbar的iphone应用程序,iphone,Iphone,如何在中定义和检查AlreadySelectedSpecific选项卡和viewControllerNotToAllow 我的申请书。谁给我举个例子 实际上我想做点什么。喜欢当选择了第二个选项卡时,如果我们选择了“第二个选项卡”,则此时不选择“第二个选项卡”,只选择“重新制作”选项卡 这就是我使用以下代码的原因 请回复 - (BOOL)tabBarController:(UITabBarController *)tabBarControllers shouldSelectViewControll
- (BOOL)tabBarController:(UITabBarController *)tabBarControllers shouldSelectViewController:(UIViewController *)viewController
{
if(alreadySelectedSpecificTab)
{
if([viewController isEqual:viewControllerNotToAllow])
return NO;
}
return YES;
}
在类中创建一些属性 并记录你想否认什么和不想否认什么
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 && //If it is nil, we will skip it.
dontAllowSelection == viewController) //If the selected view is Denied return NO
{
return NO;
}
currentlySelected = viewController;
if (currentlySelected == someViewIWantToDisableOtherFor) //Any logic can go here to enable the Denied View.
{
dontAllowSelection = anotherViewIWantDisabled; //Set my denied view.
}
else
{
dontAllowSelection = nil; //Unsed the Denial.
}
return YES;
}
我不知道你到底想做什么?