您的位置:首页 > 产品设计 > UI/UE

点击tabBarItem跳转到其他界面 返回后还是之前所选item (跳转注册)

2016-07-08 10:59 676 查看
首先设置UITabBarController的代理为appdelegate如下:myTabBar.delegate = self;

然后在interface后面写上代理<UITabBarControllerDelegate>

实现代理里面的- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController方法即可

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController
*)viewController {

    

    if([viewController.tabBarItem.title
isEqualToString:@"我的MT4"]){

        if (![WCAccount
shareAccount].login) {

            GYRegisterVC *regist=[self.storyboard
instantiateViewControllerWithIdentifier:@"GYRegisterVC"];

            [self
presentViewController:regist animated:YES
completion:nil];

            return
NO;

        }else{

            return
YES;

        }

        

        

        

        

    }else {

        

        return
YES;

        

    }

    

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息