1
votes

I'm using GTMOAuth2ViewControllerTouch to display the login screen for Google Drive in a popover. I get past the sign-in -- everything is fine there -- and the web view shows the consent screen. But the size of the consent screen data is more than twice the size of the popover (320 x ~460), requiring the user to scroll to see the Accept button. There's a lot of white space on all sides of the content, but even without that it I don't think it would all fit.

Here's how it looks on a Retina display iPad 2 running iOS 7 (life size):

enter image description here

enter image description here

I tried changing the web view in the XIB to "scales page to fit" but it had no effect. I haven't made any other changes to the XIB; both the container view and the web view are "scale to fill". Auto-layout is off for the file.

Here's how I invoke the login view controller. I'm given the controller for the popover which is currently on-sceen. That controller is a few layers down in the navigation stack.

- (void) attemptLogin: (UIViewController *) controller
    {
        GTMOAuth2ViewControllerTouch *newController = nil;

        if (![self isUserLoggedIn])
            {
            newController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive
                clientID:_googleAppKey clientSecret:_googleAppSecret keychainItemName:_googleKeychainKey
                delegate:self
                finishedSelector:@selector(viewController:finishedWithAuthorizer:error:)];
            [[controller navigationController] pushViewController:newController animated:YES];
            [newController release];
            }
    }

This isn't a disaster on the order of a dinosaur-killer asteroid, but it sure is annoying. Am I doing something wrong or is this loosy-goosy display the way it's "supposed" to work?

2
Out of interest have you found a way to remove the arrow buttons? - max_
I haven't tried, but it would be easy to delete the buttons from the XIB. (Assuming you're compiling the code into your app, not into a library.) - user3806580

2 Answers

0
votes

Use the following code on the viewDidLoad method of the ViewController:

[self.myWebView setFrame:CGRectMake(self.view.frame.origin.x,
                               self.view.frame.origin.y,
                               self.view.frame.size.width,
                               self.view.frame.size.height)];

This will force the content to be displayed within the frame size.

0
votes

The only way I've found to fix this is to change the size of the popover when I create the authorization view controller:

[newController setContentSizeForViewInPopover:CGSizeMake(768, 620)];

Kind of dopey, but it solves the problem.