在UIAlertController中添加UITextField控制台报错

jkxy_wang 2016-11-03 04:43:51
实现代码如下:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"test" message:@"test" preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @"test";
textField.adjustsFontSizeToFitWidth = YES;
}];
UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"test");
}];
[alertController addAction:cancleAction];
[self presentViewController:alertController animated:YES completion:nil];

真机调试时,iphone 6plus 9.0+的版本会出现下面的问题
the behavior of the UICollectionViewFlowLayout is not defined because:
temp[1819:71277] 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.
temp[1819:71277] The relevant UICollectionViewFlowLayout instance is <_UIAlertControllerCollectionViewFlowLayout: 0x7fb81d169b70>, and it is attached to <UICollectionView: 0x7fb81c10d800; frame = (0 120.667; 270 44); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fb81d18d800>; layer = <CALayer: 0x7fb81ae37510>; contentOffset: {0, 0}; contentSize: {0, 0}> collection view layout: <_UIAlertControllerCollectionViewFlowLayout: 0x7fb81d169b70>.
temp[1819:71277] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
但是ios 10版本又不会出现这个问题,求大神指点
...全文
255 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jkxy_wang 2016-11-03
  • 打赏
  • 举报
回复
试过,没有用呢
理公子 2016-11-03
  • 打赏
  • 举报
回复
你把message的内容去掉试试

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧