uialertcontroller

Leaks with UIAlertController

落爺英雄遲暮 提交于 2019-11-29 16:46:00
问题 I added UIAlertController in my app by creating a category on UIViewController with the following method: - (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)alertActions { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title ? : @"" message:message preferredStyle:UIAlertControllerStyleAlert]; if (alertActions.count) { for (UIAlertAction *action in alertActions) { [alertController addAction:action]; } } else {

[Swift]UIKit学习之警告框:UIAlertController和UIAlertView

拈花ヽ惹草 提交于 2019-11-29 16:45:07
Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 and later, instead use UIAlertController with a preferredStyle ofUIAlertControllerStyleAlert. ‍ ‍ 在Xcode7中使用 UIAlertView会报如下 警告: 'UIAlertView' was deprecated in iOS 9.0: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead ‍ ‍ Alert Views : Alert views display a concise and informative alert message to the user. UIAlertController 同时替代了 UIAlertView 和 UIActionSheet,从系统层级上统一了 alert 的概念 —— 即以 modal 方式或

UIAlertController tint color defaults to blue on highlight

时间秒杀一切 提交于 2019-11-29 15:58:42
问题 I'm use the following code to present a UIAlertController action sheet with the item text as red. I've used the tint property to set the color. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; alertController.view.tintColor = [UIColor redColor]; The text color seems to be defaulting to blue on highlight or selection. Is this normal and how do I stop this? 回答1: This is a known Bug, see https:/

UIAlertView in iOS8 appearing off-center, mis-placed, only portion of the screen dimmed

人走茶凉 提交于 2019-11-29 14:55:38
I'm building an iPad app on iOS8, landscape, upgrading from iOS7. I've replaced UIAlertView (deprecated) with UIAlertController in a number of other places in my app which has fixed this issue. However, I also use a UIWebView which apparently shows its own UIAlertViews. When this happens I also get the same problem (see partial pic, cropped). The alert view is misplaced lower to the left and only the left 2/3 of the screen is dimmed, and worse, the right most portion that is not dimmed still responds to touch gestures, so it's possible to control the app behind the modal! The alert that the

UIAlertController - change size of text fields and add space between them

≯℡__Kan透↙ 提交于 2019-11-29 14:19:30
My alert looks like this: Is it possible to make inputs bigger and add space between them? Here is a snippet from my code. I tried changing the frame property of the second text field but it didn't help: let alert = UIAlertController(title: title, message: message, preferredStyle: .Alert) // Add the textfields alert.addTextFieldWithConfigurationHandler({ (textField) -> Void in textField.placeholder = "Vaše jméno" }) alert.addTextFieldWithConfigurationHandler({ (textField) -> Void in textField.placeholder = "Společné heslo" var oldFrame = textField.frame oldFrame.origin.y = 40 oldFrame.size

UIAlertController change background color of Cancel button for action sheet

烈酒焚心 提交于 2019-11-29 12:30:06
I am trying to create a UIAlertController with the action sheet style but I want to change the background color to a gray color. I have been able to find a way to change the background color of the UIAlertController, but not the Cancel button. The Cancel button, which is separate, remains white. This is the code that I have right now: UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:[UIAlertAction actionWithTitle:@"Option 1" style:UIAlertActionStyleDefault handler:nil]]; [alert addAction:

Multiline editable text UITextview inside UIAlertController?

丶灬走出姿态 提交于 2019-11-29 10:34:39
How can I make a multiline editable text UITextview inside a UIAlertController ? UITextfield supports a single line and we need to make a multiline text edit box in the pop up window. Vishal This is good appraoch ... func popUpController() { let alertController = UIAlertController(title: "\n\n\n\n\n\n", message: nil, preferredStyle: UIAlertController.Style.actionSheet) let margin:CGFloat = 8.0 let rect = CGRect(x: margin, y: margin, width: alertController.view.bounds.size.width - margin * 4.0, height: 100.0) let customView = UITextView(frame: rect) customView.backgroundColor = UIColor.clear

Xcode Swift how to add image to UIAlertController options? [duplicate]

。_饼干妹妹 提交于 2019-11-29 10:27:14
问题 This question already has an answer here: Add Image to UIAlertAction in UIAlertController 7 answers i want to add image/icon to UIAlertController like the dialog inside apple music player what i want colored/sized image/icon like the image below, not like the one inside this question .i believe its ios 11+ feature but i can't find the documents for it . exactly like this : can i do this in UIAlertController or i should make my own custom dialog uiviewcontroller ? 回答1: let alert =

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

iOS 8.3 UIAlertController crashes when trying to add a textfield

不羁的心 提交于 2019-11-29 06:21:55
问题 I have an iPad app. I am creating an UIAlertController and adding a textfield. It crashes. It only crashes when I add a textfield. let alert = UIAlertController(title: "Enter Name", message:nil, preferredStyle: UIAlertControllerStyle.Alert); alert.addTextFieldWithConfigurationHandler { (textfield:UITextField!) -> Void in textfield.placeholder = "Sexy time"; } alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: {(action:UIAlertAction!) -> Void in //Some