uialertcontroller

Multiline editable text UITextview inside UIAlertController?

試著忘記壹切 提交于 2019-11-28 03:53: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. 回答1: 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,

How to add text input in alertview of ios 8?

与世无争的帅哥 提交于 2019-11-28 03:48:01
I want to add text input in alert-view of ios 8. I know it was done using UIAlertController but not have any idea. How to do it ? Screenshot Code UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Login" message: @"Input username and password" preferredStyle:UIAlertControllerStyleAlert]; [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.placeholder = @"name"; textField.textColor = [UIColor blueColor]; textField.clearButtonMode = UITextFieldViewModeWhileEditing; textField.borderStyle = UITextBorderStyleRoundedRect; }];

UIAlertController change background color of Cancel button for action sheet

╄→尐↘猪︶ㄣ 提交于 2019-11-28 02:15: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:

Show UIAlertController if already showing an Alert

a 夏天 提交于 2019-11-28 01:08:02
Difference between the legacy UIAlertView and the new UIAlertController is that the latter needs to be presented onto a specific viewcontroller with presentViewController:animated:completion: . This poses an awkward problem for my use case: what if there is already an UIAlertController showing (e.g. a rating dialog) when a second viewcontroller gets presented (e.g. an error dialog due to failed network connection). I have experienced that in this case the second UIAlertController just does not show. Edit: At the moment I try to show an alert, I do not know if there currently is anything

How to use UITextView in UIAlertController

空扰寡人 提交于 2019-11-27 22:20:31
问题 I created a popup alert using alert controller and added two alert actions(ok and cancel) as below. UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Cycling" message:@"Please enter title and description" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; UIAlertAction* cancel =

Concurrent UIAlertControllers

给你一囗甜甜゛ 提交于 2019-11-27 22:12:18
I'm porting my app to iOS 8.0 and notice that UIAlertView is deprecated. So I've changed things to use a UIAlertController. Which works in most circumstances. Except, when my app opens, it does several checks to report various states back to the user... E.g... "Warning, you haven't set X up and need to do Y before completing projects" and "Warning, you are using a beta version and do not rely on results" etc...(these are just examples!) Under the UIAlertView, I would (say) get two alert boxes concurrently which the user has to tap twice to dismiss both...but they both appear. Under

UIAlertController if iOS 8, otherwise UIAlertView

那年仲夏 提交于 2019-11-27 22:01:16
问题 I want to conform to the UIAlertController used in iOS 8 since UIAlertView is now deprecated. Is there a way that I can use this without breaking support for iOS 7? Is there some kind of if condition I can do to check for iOS 8 otherwise do something else for iOS 7 support? 回答1: Please see the answer of Erwan (below my answer) as I see it is the best. -- You can check the iOS version to use appropriate control like this: if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options

How to change UIAlertController button text colour in iOS9?

别来无恙 提交于 2019-11-27 21:33:24
问题 The question is similar to iOS 8 UIActivityViewController and UIAlertController button text color uses window's tintColor but in iOS 9. I have a UIAlertController and the dismiss button keeps white colour even I have tried to set [[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]]; UIAlertController *strongController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:preferredStyle]; strongController.view

Display UIAlertController from UIView/NSObject class

杀马特。学长 韩版系。学妹 提交于 2019-11-27 20:30:53
I have working iOS application In order to support iOS8 , I am replacing UIAlertView/UIActionSheet with UIAlertController . Problem : For display UIAlertController I need presentViewController method of UIViewController class. But UIAlertView is display from classes which are inherited from UIView or NSObject , I can not get [self presentViewController...] method for obvious reason. My Work : I tried getting rootViewController form current window and display UIAlertController. [[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController ...] but have some rotation

Check on UIAlertController TextField for enabling the button

我怕爱的太早我们不能终老 提交于 2019-11-27 20:12:22
问题 I have an AlertController with a text field and two button: CANCEL and SAVE. This is the code: @IBAction func addTherapy(sender: AnyObject) { let addAlertView = UIAlertController(title: "New Prescription", message: "Insert a name for this prescription", preferredStyle: UIAlertControllerStyle.Alert) addAlertView.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: nil)) addAlertView.addAction(UIAlertAction(title: "Save", style: UIAlertActionStyle.Default,