Google Drive iOS SDK:显示取消登录按钮

Google Drive iOS SDK:显示取消登录按钮,第1张

概述我正在使用iOS应用程序,我使用Google驱动器访问我的文件,登录和列表文件工作正常,但我只是问我如何在Google驱动器sdk提供的登录界面上添加取消按钮,请参阅图像怒吼 因为,你看到没有办法做一个取消或返回按钮. 这是我的代码 // verify if the user is already connected or not - (void)checkIfIsConnected 我正在使用iOS应用程序,我使用Google驱动器访问我的文件,登录和列表文件工作正常,但我只是问我如何在Google驱动器sdk提供的登录界面上添加取消按钮,请参阅图像怒吼

因为,你看到没有办法做一个取消或返回按钮.

这是我的代码

// 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:显示取消登录按钮所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1084760.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存