CustomIOS7AlertView.m死机问题修改

在适配ios7时需要用到自定义对话框,下载了CustomIOS7AlertView,使用时经常遇到程序死机崩溃,定位问题发现出在[CustomIOS7AlertView countScreenSize]这个函数的调用上。

百思不得其解,后来把[buttonTitles count]注释了才好。这才想起来,好像用的时候没有给buttonTitles赋值,用的默认的Close按钮,所以这里取不到数值,导致程序崩溃的。


以下是注释后的函数。


- (CGSize)countScreenSize
{
    // && [buttonTitles count] > 0
    if (buttonTitles!=NULL) {
        buttonHeight       = kCustomIOS7AlertViewDefaultButtonHeight;
        buttonSpacerHeight = kCustomIOS7AlertViewDefaultButtonSpacerHeight;
    } else {
        buttonHeight = 0;
        buttonSpacerHeight = 0;
    }
   
    CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
    
    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
    if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
        CGFloat tmp = screenWidth;
        screenWidth = screenHeight;
        screenHeight = tmp;
    }
   
    return CGSizeMake(screenWidth, screenHeight);

}



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值