iOS Plus屏幕 AlerController报错

使用UIAlertController 在6P/6sP屏幕时报错


2016-06-02 10:03:27.023 app[1581:584039] the behavior of the UICollectionViewFlowLayout is not defined because:
2016-06-02 10:03:27.023 app[1581:584039] the item height must be less than the height of the UICollectionView minus
 the section insets top and bottom values, minus the content insets top and bottom values.
2016-06-02 10:03:27.025 app[1581:584039] The relevant UICollectionViewFlowLayout instance is 
<_UIAlertControllerCollectionViewFlowLayout: 0x1603a9e80>, and it is attached to <UICollectionView: 0x15f30ce00; 
frame = (0 120.667; 270 44); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x1603aa940>; 
layer = <CALayer: 0x1603aa3b0>; contentOffset: {0, 0}; contentSize: {0, 0}> collection view layout: 
<_UIAlertControllerCollectionViewFlowLayout: 0x1603a9e80>.
2016-06-02 10:03:27.025 app[1581:584039] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes 
to catch this in the debugger.

UIAlertController代码如下:

 
    UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"账号验证" message:@"请输入138****1145的中间四位" preferredStyle:UIAlertControllerStyleAlert];
    
    [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
        textField.placeholder = @"请输入138****1145的中间四位";
        textField.textAlignment = NSTextAlignmentCenter;
    }];
    
    UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alert addAction:cancelAction];
    [alert addAction:sureAction];
    [self presentViewController:alert animated:YES completion:nil];



 

解决的方法:在[self presentViewController:alert animated:YES completion:nil];之前增加一句代码:

    [alert.view setNeedsLayout];
    [self presentViewController:alert animated:YES completion:nil];

解决问题的帮助网页链接: 点击打开链接


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值