uialertaction

UIAlertAction Button Text Alignment Left

痞子三分冷 提交于 2019-11-29 10:26:12
问题 I want to align UIAlertAction text alignment to Left and add the icon as in image shown. I spent lot of time on google to get the solution but not found the right answer. Every body post for the alert title not for the alert action title. Please suggest me the right way for swift . Thanks!! 回答1: You can do that with bellow example code. Easy and Simple. Swift 4 let actionSheetAlertController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let

iOS8统一的系统提示控件——UIAlertController

筅森魡賤 提交于 2019-11-28 16:56:12
iOS8统一的系统提示控件——UIAlertController 一、引言 相信在iOS开发中,大家对UIAlertView和UIActionSheet一定不陌生,这两个控件在UI设计中发挥了很大的作用。然而如果你用过,你会发现这两个控件的设计思路有些繁琐,通过创建设置代理来进行界面的交互,将代码逻辑分割了,并且很容易形成冗余代码。在iOS8之后,系统吸引了UIAlertController这个类,整理了UIAlertView和UIActionSheet这两个控件,在iOS中,如果你扔使用UIAlertView和UIActionSheet,系统只是会提示你使用新的方法,iOS9中,这两个类被完全弃用,但这并不说明旧的代码将不能使用,旧的代码依然可以工作很好,但是会存在隐患,UIAlertController,不仅系统推荐,使用更加方便,结构也更加合理,作为开发者,使用新的警示控件,我们何乐而不为呢。这里有旧的代码的使用方法: UIAlertView使用: http://my.oschina.net/u/2340880/blog/408873 。 UIActionSheet使用: http://my.oschina.net/u/2340880/blog/409907 。 二、UIAlertController的使用 从这个类的名字我们就可以看出,对于警示控件

How should you handle closure arguments for UIAlertAction

可紊 提交于 2019-11-28 09:11:30
问题 I have been trying to create a UIAlertAtion which also has a handler. I read the answers from this question and know how to do it. My question is only about the closure portion of it. 1) I know I can write : {alert in println("Foo")} Or {_ in println("Foo")} but I can't write {println("Foo")} . In the comments here it is explained because you need to handle the argument action . Does this mean that since the handler is of type (UIAlertAction) -> Void)? I must always capture the passed

How to edit UIAlertAction text font size and color

↘锁芯ラ 提交于 2019-11-27 02:46:27
问题 How to edit UIAlertAction text size and color? I have taken a UIAlertController acoording to it how to edit the size. This i smy Code UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Do you wish to logout?" message:@"" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *logOut = [UIAlertAction actionWithTitle:@"Log Out" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {}]; Now i want my 'Log Out' text with font size 22 and green