小编BKj*_*dav的帖子

UITertController与UITextfield不显示标题和消息

请帮我解决以下问题.

UIAlertController *alertController = [UIAlertController  alertControllerWithTitle:@"Check"  message:@"What was the value collected?"  preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField)
{
    textField.keyboardType = UIKeyboardTypeNumberPad;
    textField.placeholder = @"What was the value collected?";
}];

[alertController addAction:[UIAlertAction actionWithTitle:@"Submit" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) 
{                  
    UITextField *txtValue = alertController.textFields.firstObject;                    
    toCollect = [txtValue.text floatValue];
}]];
[self presentViewController:alertController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

我使用上面的代码,但它显示我的结果在下面的截图.无法显示标题和消息
在此输入图像描述

提前致谢 !

objective-c ios ios8

5
推荐指数
1
解决办法
972
查看次数

标签 统计

ios ×1

ios8 ×1

objective-c ×1