因为,你看到没有办法做一个取消或返回按钮.
这是我的代码
// verify if the user is already connected or not - (voID)checkIfIsConnected { // Check for authorization. GTMOAuth2Authentication *auth = [GTMOAuth2VIEwControllertouch authForGoogleFromKeychainForname:kKeychainItemname clIEntID:kClIEntID clIEntSecret:kClIEntSecret]; if ([auth canAuthorize]) { [self isAuthorizeDWithAuthentication:auth]; }else { [self ConnectToDrive]; } } - (GTLServiceDrive *)driveService { static GTLServiceDrive *service = nil; if (!service) { service = [[GTLServiceDrive alloc] init]; // Have the service object set tickets to fetch consecutive pages // of the Feed so we do not need to manually fetch them. service.shouldFetchNextPages = YES; // Have the service object set tickets to retry temporary error conditions // automatically. service.retryEnabled = YES; } return service; } -(voID) ConnectToDrive{ SEL finishedSelector = @selector(vIEwController:finisheDWithAuth:error:); GTMOAuth2VIEwControllertouch *authVIEwController = [[GTMOAuth2VIEwControllertouch alloc] initWithScope:kGTLAuthScopeDrive clIEntID:kClIEntID clIEntSecret:kClIEntSecret keychainItemname:kKeychainItemname delegate:self finishedSelector:finishedSelector]; [self.fileManagementVIEwController presentModalVIEwController:authVIEwController animated:YES]; } // Action executed after finishing the Authentication - (voID)vIEwController:(GTMOAuth2VIEwControllertouch *)vIEwController finisheDWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error { [self.fileManagementVIEwController dismissModalVIEwControllerAnimated:YES]; if (error == nil) { [self isAuthorizeDWithAuthentication:auth]; } } - (voID)isAuthorizeDWithAuthentication:(GTMOAuth2Authentication *)auth { [[self driveService] setAuthorizer:auth]; self.isAuthorized = YES; [self loadDrivefiles]; }
那怎么了?
解决方法 请按照步骤 –转到 – > GTLSource->共> OAuth2->触 – > GTMOAuth2VIEwControllertouch.m
-(voID)vIEwDIDLoad{[self setUpNavigation];[self.navigationController.navigationbar setTitleTextAttributes:@ {NSForegroundcolorAttributename : [UIcolor bluecolor]}];self.navigationController.navigationbar.translucent = NO;UINavigationbar *navibarObj = [[UINavigationbar alloc] initWithFrame:CGRectMake(0,320,63)];[self.vIEw addSubvIEw:navibarObj];UIbarbuttonItem *cancelitem = [[UIbarbuttonItem alloc]initWithTitle:[Nsstring stringWithFormat:NSLocalizedString(@"Cancel",nil)] style:UIbarbuttonItemStylebordered target:self action:@selector(cancelGdriveSignIn:)]; UINavigationItem *navigItem = [[UINavigationItem alloc] initWithTitle:@"Google Drive"];navigItem.rightbarbuttonItem = cancelitem;navibarObj.items = [NSArray arrayWithObjects: navigItem,nil]; } -(voID)cancelGdriveSignIn:(ID)sender { [self dismissVIEwControllerAnimated:YES completion:^(voID){}]; }-(voID)setUpNavigation // Default Method Available { rightbarbuttonItem_.customVIEw = navbuttonsVIEw_; self.navigationItem.rightbarbuttonItem = rightbarbuttonItem_;}
一旦在GTMOAuth2VIEwControllertouch.m中添加上述更改并运行它.你会得到这样的取消按钮 –
快乐编码……
总结以上是内存溢出为你收集整理的Google Drive iOS SDK:显示取消登录按钮全部内容,希望文章能够帮你解决Google Drive iOS SDK:显示取消登录按钮所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)