[英]How can i put navigation bar in google login screen?
因为如果用户不想登录,则无法返回到先前的屏幕,用户必须杀死该应用程序。
确保您的UIWebView
在具有UINavigationController
的视图控制器内部。 我怀疑您以模式方式(通过情节提要或以编程方式)显示登录屏幕-尝试将其推入导航堆栈。
编辑:这是我的意思,在QEFilesListViewController
的代码:
GTMOAuth2ViewControllerTouch *authViewController =
[[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDriveFile
clientID:kClientId
clientSecret:kClientSecret
keychainItemName:kKeychainItemName
delegate:self
finishedSelector:finishedSelector];
[self presentViewController:authViewController
animated:YES
completion:nil];
如果您将最后一条语句更改为
[self.navigationController pushViewController:authViewController animated:YES];
您将获得一个后退按钮:
我知道,当您按下返回按钮时,它将自动再次显示登录屏幕。 我认为,如果要在自己的应用程序中实现此功能,则可以采取适当的措施以确保不会发生这种情况。
尝试下面的代码。 这个补丁解决了我的问题。
GTMOAuth2ViewControllerTouch *authViewController = [GTMOAuth2ViewControllerTouch controllerWithScope:kGTLAuthScopeDrive
clientID:GoogleDriveClientID
clientSecret:GoogleDriveClientSecret
keychainItemName:GoogleDriveKeychainItemName
completionHandler:authCompletionHandler];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:authViewController];
navigationController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[rootController presentViewController:navigationController animated:YES completion:nil];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIBarButtonItemStylePlain
target:self
action:@selector(didCanceledAuthorization)];
authViewController.navigationItem.rightBarButtonItem = nil;
authViewController.navigationItem.leftBarButtonItem = cancelButton;
authViewController.navigationItem.title = @"Google Drive";
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.