[UIAlertController & UIAlertAction] 简介

UIAlertController object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts. After configuring the alert controller with the actions and style you want, present it using the presentViewController:animated:completion: method.

UIAlertController 对象显示了一条警告alert信息给用户。这个类取代了 UIActionSheet 和 UIAlertView 类来显示警告。在用你想要的动作和样式配置好警告 控制器之后,用 presentViewController:animated:completion: 方法来呈现它。

In addition to displaying a message to a user, you can associate actions with your alert controller to give the user a way to respond. For each action you add using the addAction: method, the alert controller configures a button with the action details. When the user taps that action, the alert controller executes the block you provided when creating the action object.

除了显示一条信息给用户外,你还可以给警告控制器添加动作来提供一个给用户回答的方式。对于你使用addAction:方法添加的每一个动作,alert controller 都会配置一个带有动作细节的按钮。当用户敲击动作按钮时,动作控制器会执行你创建动作对象提供的方块。

UIAlertAction object represents an action that can be taken when tapping a button in an alert. You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. After creating an alert action object, add it to a UIAlertController object before displaying the corresponding alert to the user.

UIAlertAction 对象呈现了一个在alert事件中一个按钮被敲击的时候可以被执行的动作 。 使用这个类来配置关于单个动作的信息,包括了显示在按钮上的title,任意的样式信息还有handler在按钮被敲击的时候来执行动作。在创建好alert 的action 对象后,在显示响应的alert前把它添加给一个 UIAlertController 对象。

时间: 2024-08-28 05:19:46

[UIAlertController & UIAlertAction] 简介的相关文章

ios之开发屏幕适配和系统版本适配

ios软件开发过程中很重要的一点是对系统和屏幕进行适配对系统的适配主要是IOS7以后和之前以及IOS8新增特性,屏幕适配主要是对不同设备采用不同的布局以最佳展示效果展现给用户. 针对系统的适配: IOS7以后和之前 <span style="font-size:18px;background-color: rgb(255, 255, 255);">#define IOSVersion [[[UIDevice currentDevice] systemVersion] flo

iOS知识点、面试题 之二

最近面试,发现这些题个人约到的几率打一些,与大家分享一下,分三文给大家: 当然Xcode新版本区别,以及iOS新特性 Xcode8 和iOS 10 在之前文章有发过,感兴趣的可以查阅: http://www.cnblogs.com/xujiahui/p/6025830.html 不足之处望见谅. 之二: 1.怎么样适配ios系统和ios屏幕 ios适配系统代码写法[[UIDevice currentDevice] systemVersion] 和NSFoundationVersionNumber

iOS:界面适配(三)--iPhone不同机型或设备不同尺寸适配(屏幕适配)和系统适配

对于不同苹果设备,各个参数查看<iOS:机型参数.sdk.xcode各版本>.        机型变化 坐标:表示屏幕物理尺寸大小,坐标变大了,表示机器屏幕尺寸变大了: 像素:表示屏幕图片的大小,跟坐标之间有个对应关系,比如1:1或1:2等: ppi:代表屏幕物理大小到图片大小的比例值,如果ppi不变,则坐标和像素的比例不会变: iPhone 4以前 iPhone.iPhone3/3G机型未采用retina,坐标是320 x 480,屏幕像素320 x 480 ,他们一一对应,1:1关系.即一

iOS关于UITabView和UIAlertController,UIAlertAction以及UINavigation,值修改的传递页面推送

关于UITabView和UIAlertController,UIAlertAction以及UINavigation,值修改的传递 集合嵌套集合的操作 声明 两个必须的的代理 实现部分代码 - (void)viewDidLoad { [super viewDidLoad]; // 创建一个TabView self.tabv = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped]; sel

UIAlertController、UIAlertAction 警告框

NS_CLASS_AVAILABLE_IOS(8_0) @interface UIAlertAction : NSObject <NSCopying> //创建操作 + (instancetype)actionWithTitle:(nullable NSString *)title style:(UIAlertActionStyle)style handler:(void (^ __nullable)(UIAlertAction *action))handler; NS_CLASS_AVAIL

iOS--UIAlertView与UIAlertController和UIAlertAction之间的事儿

iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸变化效果(比如说旋转)中发挥了重要的作用,它有效地节省了程序员们的工作量(天地良心啊).还有,某些旧的UIKit控件也同样发生了许多变化,比如说Alert Views.ActionSheets.Popovers以及Search Bar Controllers.本文将会对Alert Views和Act

iOS:UIAlertController和UIAlertAction的详解

提示框控制器:UIAlertController 提示框按钮:UIAlertAction 功能:用来提示信息,并给出一些可以进行选择的按钮来处理相应的要求. 注意:在Xcode的iOS8 SDK中,UIAlertView和UIActionSheet都被UIAlertController取代.官方库解释: “UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyle

iOS--UIAlertView与UIAlertController和UIAlertAction

iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸变化效果(比如说旋转)中发挥了重要的作用,它有效地节省了程序员们的工作量(天地良心啊).还有,某些旧的UIKit控件也同样发生了许多变化,比如说Alert Views.ActionSheets.Popovers以及Search Bar Controllers.本文将会对Alert Views和Act

iOS核心笔记——UIAlertController

1.UIAlertController简介: ※了解:UIAlertController - - -> 提醒框控制器,在需要提醒用户执行某些操作时使用:通常分为两种样式:中间提醒框.底部提醒框. 苹果官方介绍: 2.UIAlertController使用: 2-1.UIAlertController样式: 1.UIAlertController有2种样式: 如下如所示: 2-2.UIAlertController使用步骤: UIAlertController使用alertControllerWi