这个让我发疯。
从我的根视图控制器,我正在推动另一个视图控制器,以强制用户输入一些凭据才能登录。除非凭据不正确,否则用户将无法切换回根视图。为此,我试图隐藏“后退”按钮,但是由于某些原因,这不起作用。
有什么建议么?
- (void)presentLoginWebView
{
UIViewController *webViewController = [[UIViewController alloc] init];
webViewController.title = NSLocalizedString(@"IB_LOG_IN_TITLE", nil);
UIWebView *webView = [[UIWebView alloc] initWithFrame:webViewController.view.frame];
webViewController.view = webView;
[self.navigationController pushViewController:webViewController animated:NO];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:IB_GET_OAUTH_TOKEN_URL]]];
webView.scalesPageToFit = YES;
webView.delegate = self; //delegate methods below
if (deviceVersion > 6)
{
[self.navigationController.interactivePopGestureRecognizer setEnabled:NO];
}
[self.navigationController.navigationItem setHidesBackButton:YES];
//The following line doesn't work either
//self.presentedViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:[[UIView alloc] init]];
}
最佳答案
尝试隐藏webViewController
的后退按钮
webViewController.navigationItem.hidesBackButton = YES;
关于ios - setHidesBackButton不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21572993/