Alert view is showing white rectangle in iOS7

后端 未结 3 1455
终归单人心
终归单人心 2020-12-01 12:51

The following code works perfectly from iOS 5 to 6.1. I even have applications in store with that code:

-(void)showActivityIndicator
{
    if(!mLoadingView)          


        
相关标签:
3条回答
  • 2020-12-01 13:21

    now addSubview is not available in UIAlertView in iOS7

    The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified

    As an alternative you can use SVProgressHUD.

    0 讨论(0)
  • 2020-12-01 13:25

    I had to fix this problem very quickly, hence I have built an iOS7 UIAlertView-style UIView with its animations, which can be extended with any custom content.

    There might be others who can use my solution, so I made the whole code available on Github.

    enter image description here

    Also, if you want to keep using the UIAlertView under previous OS versions, you have to fork the code. It might be as bad as it sounds, I'm using the following:

    float sysVer = [[[UIDevice currentDevice] systemVersion] floatValue];
    
    if (sysVer < 7) {
      // your old solution
    } else {
      .. // iOS7 dialog code
    }
    

    (Please be aware that this is by no means a real solution - if Apple doesn't want us to use the dialogs for all sorts of things, then we probably shouldn't.)

    0 讨论(0)
  • 2020-12-01 13:44

    From iOS 7 onwards, you can do:

        [alertView setValue:customContentView forKey:@"accessoryView"];
    

    to get custom content in a standard alert view.

    0 讨论(0)
提交回复
热议问题