UIAlertController添加输入框问题?
ViewController * vc = (id)self.parentViewController;
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"Create Wishlist" message:@"" preferredStyle:UIAlertControllerStyleAlert];
// 创建文本框
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField){
textField.placeholder = @"登录";
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *createAction = [UIAlertAction actionWithTitle:@"Create" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//读取收入框的内容的方法
UITextField *login = alertController.textFields.firstObject;
}];
[alertController addAction:cancelAction];
[alertController addAction:createAction];
[vc presentViewController:alertController animated:YES completion:nil];
为什么对话框弹出来,不显示输入框??控制台报一堆的debugger
The relevant UICollectionViewFlowLayout instance is <_UIAlertControllerCollectionViewFlowLayout: 0x7ff4630e4000>, and it is attached to <UICollectionView: 0x7ff461828600; frame = (0 104.667; 270 44); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7ff4630e4cd0>; layer = <CALayer: 0x7ff4630e4640>; contentOffset: {0, 0}; contentSize: {0, 0}> collection view layout: <_UIAlertControllerCollectionViewFlowLayout: 0x7ff4630e4000>
这是什么情况??