页面跳转出现问题

iOS 码拜 9年前 (2015-11-13) 902次浏览
提示这个错误: Presenting view controllers on detached view controllers is discouraged <HomeViewController: 0x7c02d270>.
本人是在button点击事件里面这样写的跳转

-(void)titleBtnClick:(UIButton *)titlebtn
{
        SubscriptionViewController *subscr = [[SubscriptionViewController alloc] init];
        [self presentViewController:subscr animated:YES completion:nil];
}

这样写有什么问题吗?
本人的主页没有加导航   也没有tabbar   不能用push  只是在主页的view上面写了个btn   点击btn跳转到另外一个界面

解决方案:40分
试试这个吧:

[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:subscr animated:YES completion:nil];

减少耦合度


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明页面跳转出现问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)