Please follow the steps -
Go to--> GTLSource->Common->OAuth2->Touch-->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, 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_;
}
Once you add the above changes in the GTMOAuth2ViewControllerTouch.m and run it. you will get cancel button like this-
Happy Coding......!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…