zoukankan      html  css  js  c++  java
  • 加在window上的view 出现一闪而过的情况

    加在window上的view 出现一闪而过的情况

    主要是因为界面上也添加了UIAlertView

    在UIAlterView的代理方法中 -(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

     添加一个UIView到[[UIApplication sharedApplication].keyWindow上,却只出现了0.5秒左右就消失

    在这里,我们需要注意,

    在有UIAlertView的地方,通过 [UIApplication sharedApplication].keyWindow 获取到的窗口是alertView的,因为他的级别最高(霸屏),所以这里,只要alertView消失的时候,你添加到window的view也会一起跟着消失了。

    在这里解决办法可以做一个延时,alertView消失0.5秒后,创建view,add view,注意延时的时间要大于0.5秒。

    -(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

            [self downloadFileWithUrl:self.currWineClassInfo.fileUrl];

            [self performSelector:@selector(delayView) withObject:nil afterDelay:0.6];

        }

    }

    -(void)delayView {

    UIView *v = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];  

    v.backgroundColor = [UIColor redColor];  

    [[UIApplication sharedApplication].keyWindow addSubview:v];  

    }

  • 相关阅读:
    【Cloud Foundry】Could Foundry学习(二)——核心组件分析
    POJ 1789-Truck History
    设置静态IP
    oracle切割字符串后以单列多行展示
    SQL server语句练习
    hdu 3308 LCIS(线段树)
    HDU 1556 Color the Ball 线段树 题解
    CSipSimple最新版本号
    奢侈品行业-新手专题-亿邦动力网
    单身潮_百度百科
  • 原文地址:https://www.cnblogs.com/wuxiufang/p/8796018.html
Copyright © 2011-2022 走看看