iOS UIAlertController使用方法如何使用
2016-05-18 17:15
633 查看
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"密码"
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
//
可以在这里对textfield进行定制,例如改变背景色
textField.placeholder =
@"请输入私人直播室的密码";
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {
NSLog(@"The \"Okay/Cancel\" alert's cancel action occured.");
}];
UIAlertAction *otherAction = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"The \"Okay/Cancel\" alert's other action occured.");
}];
// Add the actions.
[alertController addAction:cancelAction];
[alertController addAction:otherAction];
[self
presentViewController:alertController animated:YES
completion:nil];
alertControllerWithTitle:@"密码"
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
//
可以在这里对textfield进行定制,例如改变背景色
textField.placeholder =
@"请输入私人直播室的密码";
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {
NSLog(@"The \"Okay/Cancel\" alert's cancel action occured.");
}];
UIAlertAction *otherAction = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"The \"Okay/Cancel\" alert's other action occured.");
}];
// Add the actions.
[alertController addAction:cancelAction];
[alertController addAction:otherAction];
[self
presentViewController:alertController animated:YES
completion:nil];
相关文章推荐
- angular+ui-router+requirejs整合demo
- [解决方案]MySql提示:The server quit without updating PID file(…)失败
- UiAutomator——如何保存测试异常现场@Before @After
- iOS UITabBarController中设置字体颜色及大小
- MXE (M cross environment) Requirements
- Longest Increasing Subsequence
- 关于UIView布局的总结
- leetcode 232. Implement Queue using Stacks
- UIUITableView仿淘宝的两列式cell显示
- UE4之GamePlay
- iOS学习之—— UIDevice、NSBundle、NSLocale
- iOS 视图UIview属性介绍 以及视图层次方法
- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- 使用UIBezierPath和CAShapeLayer画各种图形
- 10.UIImageView
- IOS开发 REST请求 ASIHTTPRequest用法
- iOS UITextFiled 后边的小叉号或是一次性删除输入的文字
- AndroidStudio导入新项目一直卡在Building gradle project info的解决解决方案
- PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别
- 一图了解View的生命周期,自定义view,invalidate()和requestLayout()调用