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];  

    }

  • 相关阅读:
    Java的JXL操作xls形式
    UILabel iOS添加文本控件
    并行随机梯度下降
    ArcGIS For Flex给定两个
    如何判断一个网址是由哪种语言写的
    ArrayList线程不安全?
    java总结,错误集
    centos安装Chromium
    读书笔记:《从一到无穷大》
    读书笔记:《数学之美》
  • 原文地址:https://www.cnblogs.com/wuxiufang/p/8796018.html
Copyright © 2011-2022 走看看