Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

objective c - UIAlertView in iOS8 appearing off-center, mis-placed, only portion of the screen dimmed

I'm building an iPad app on iOS8, landscape, upgrading from iOS7. I've replaced UIAlertView (deprecated) with UIAlertController in a number of other places in my app which has fixed this issue. However, I also use a UIWebView which apparently shows its own UIAlertViews. When this happens I also get the same problem (see partial pic, cropped). The alert view is misplaced lower to the left and only the left 2/3 of the screen is dimmed, and worse, the right most portion that is not dimmed still responds to touch gestures, so it's possible to control the app behind the modal!

The alert that the UIWebView throws is a standard "wants to use your location" alert. How do I fix this for UIWebView? Thanks!

enter image description here

EDIT: problem typically occurs when the app is brought to active state after trying to show the alert while backgrounded

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I met a similar issue with iPhone, this happens when the application supports multiple rotation mask and is forced to strictly one. Basically, the viewController for example has shouldAutoRotate = NO, this only affects the view controller not the current window which is the alertView presented by the UIWebView.

Try implementing application:supportedInterfaceOrientationsForWindow Here is an example:

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return (enablesRotation == YES) ? UIInterfaceOrientationMaskAllButUpsideDown : UIInterfaceOrientationMaskLandscape;
}

This tells that the current window must follow the desired supported orientation mask. Hopes this helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...