• alertView不能自动隐藏——谈多线程执行延迟对应用程序的影响


    CommonAlert.m中的方法执行的快时,alertView的显示和消失是正常的。如下所示:

    2013-01-24 23:31:59.978 点餐系统[5649:707] 进入OrderListViewController.m-(IBAction)btnTaocanMenuClicked:(id)sender

    2013-01-24 23:31:59.982 点餐系统[5649:707] 进入CommonAlert.mstartAlertView

    2013-01-24 23:31:59.986 点餐系统[5649:5e0b] 进入CommonAlert.mstartAlertProcess

    2013-01-24 23:31:59.989 点餐系统[5649:5f07] 进入CommonAlert.mpresentAlert

    2013-01-24 23:31:59.995 点餐系统[5649:707] 进入OrderListViewController.m-(void)ShowOrderMenu

    2013-01-24 23:31:59.997 点餐系统[5649:707] 进入OrderListViewController.m-(void)clearSmallOrderList:(NSString *)code

    2013-01-24 23:32:00.003 点餐系统[5649:707] 进入OrderListViewController.m-(void)getFoodByType:(NSString *)typeCode Type:(NSInteger) type PackageId:(NSString *)packageid

    2013-01-24 23:32:00.042 点餐系统[5649:5f07] 进入JKCustomAlert.m- (void) show

    2013-01-24 23:32:00.054 点餐系统[5649:5f07] 进入JKCustomAlert.m- (void) layoutSubviews

    2013-01-24 23:32:00.063 点餐系统[5649:5f07] 进入JKCustomAlert.m- (void) layoutSubviews

    2013-01-24 23:32:00.066 点餐系统[5649:5f07] 进入JKCustomAlert.m- (void)drawRect:(CGRect)rect      

    2013-01-24 23:32:00.085 点餐系统[5649:707] 进入OrderListViewController.m-(void)parserTaocan:(NSMutableArray *)foodlist

    2013-01-24 23:32:00.089 点餐系统[5649:707] smallPic:

    2013-01-24 23:32:00.093 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:32:00.101 点餐系统[5649:707] smallPic:

    2013-01-24 23:32:00.105 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:32:00.134 点餐系统[5649:707] smallPic:

    2013-01-24 23:32:00.137 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:32:00.148 点餐系统[5649:707] 进入OrderListViewController.m-(void)animationOglFlip

    2013-01-24 23:32:00.151 点餐系统[5649:707] 进入CommonAlert.mdismissAlertView

    2013-01-24 23:32:00.739 点餐系统[5649:707] 进入JKCustomAlert.m- (void)dealloc 

    CommonAlert.m中的方法执行的慢时,alertView的就无法正常消失。因为,当我们调用dismissAlertView方法时,alertView还没有绘制出来呢!而当alertView绘制出来时,dismissAlertView方法早已错过。

    2013-01-24 23:35:03.687 点餐系统[5649:707] 进入OrderListViewController.m-(IBAction)btnTaocanMenuClicked:(id)sender

    2013-01-24 23:35:03.690 点餐系统[5649:707] 进入CommonAlert.mstartAlertView

    2013-01-24 23:35:03.693 点餐系统[5649:442f] 进入CommonAlert.mstartAlertProcess

    2013-01-24 23:35:03.696 点餐系统[5649:690f] 进入CommonAlert.mpresentAlert

    2013-01-24 23:35:03.702 点餐系统[5649:707] 进入OrderListViewController.m-(void)ShowOrderMenu

    2013-01-24 23:35:03.704 点餐系统[5649:707] 进入OrderListViewController.m-(void)clearSmallOrderList:(NSString *)code

    2013-01-24 23:35:03.709 点餐系统[5649:707] 进入OrderListViewController.m-(void)getFoodByType:(NSString *)typeCode Type:(NSInteger) type PackageId:(NSString *)packageid

    2013-01-24 23:35:03.746 点餐系统[5649:707] 进入OrderListViewController.m-(void)parserTaocan:(NSMutableArray *)foodlist

    2013-01-24 23:35:03.748 点餐系统[5649:707] smallPic:

    2013-01-24 23:35:03.751 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:35:03.759 点餐系统[5649:707] smallPic:

    2013-01-24 23:35:03.763 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:35:03.770 点餐系统[5649:707] smallPic:

    2013-01-24 23:35:03.773 点餐系统[5649:707] 进入OrderListViewController.m-(NSString *)documentsFolder

    2013-01-24 23:35:03.780 点餐系统[5649:707] 进入OrderListViewController.m-(void)animationOglFlip

    2013-01-24 23:35:03.783 点餐系统[5649:707] 进入CommonAlert.mdismissAlertView

    2013-01-24 23:35:03.793 点餐系统[5649:690f] 进入JKCustomAlert.m- (void) show

    2013-01-24 23:35:03.805 点餐系统[5649:690f] 进入JKCustomAlert.m- (void) layoutSubviews

    2013-01-24 23:35:03.817 点餐系统[5649:690f] 进入JKCustomAlert.m- (void) layoutSubviews

    2013-01-24 23:35:03.824 点餐系统[5649:690f] 进入JKCustomAlert.m- (void)drawRect:(CGRect)rect

    解决方案: 在执行dismissAlertView前让线程暂停0.5,如:    [NSThreadsleepForTimeInterval:0.5];  

     
  • 相关阅读:
    第二个冲刺
    实验四主存空间的分配和回收
    Sprint总结
    Sprint回顾
    Scrum项目5.0
    hibernate jpa 注解 @Temporal(TemporalType.DATE) 格式化时间日期,页面直接得到格式化类型的值
    获得HttpServletResponse及其他对象
    UUID.randomUUID()方法介绍
    psp个人软件过程需求文档
    电子产品自动搜索比价系统设计与实现 项目愿景与范围
  • 原文地址:https://www.cnblogs.com/ygm900/p/2875942.html
Copyright © 2020-2023  润新知