您的位置:首页 > 产品设计 > UI/UE

UIAlertController

2015-11-12 15:20 369 查看
集成了UIAlertView和UIActionSheet的功能

通过选择风格, 可以选择上述两种样式

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"版本信息" message:nil preferredStyle:UIAlertControllerStyleAlert];


这里选择弹出框样式, 可以制成登陆框样式

alertController.addTextFieldWithConfigurationHandler {
(textField: UITextField!) -> Void in
textField.placeholder = "登录"
}
alertController.addTextFieldWithConfigurationHandler {
(textField: UITextField!) -> Void in
textField.placeholder = "密码"
textField.secureTextEntry = true
}


添加按钮

//                UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:nil];
//                [alertController addAction:cancleAction];
[alertController addAction:okAction];


//

[self presentViewController:alertController animated:YES completion:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: