uialertcontroller

How do I add a UIAlertController in app delegate (obj-c)

时光怂恿深爱的人放手 提交于 2019-12-12 18:14:00
问题 This is the code I was using prior to UIAlertView being deprecated: //OLD UIALERTVIEW - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. // check to see if newer version exists to alert the user BOOL updateAvailable = NO; NSDictionary *updateDictionary = [NSDictionary

Access textfield of UIAlertController - swift ios8

十年热恋 提交于 2019-12-12 13:46:35
问题 I'm trying to access the text field of a UIAlertView and I'm using the textFields property and I get the following output from the textFields property: <_UIAlertControllerTextField: 0x7fe911f96790; frame = (4 4; 231 16); text = 'THIS IS THE TEXT THAT I JUST ENTERED'; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x7fe914215cc0>; layer = <CALayer: 0x7fe911f96c40>> As you can see the text does show up, but I need the text separately. textFields.text won't work because its

Custom View in UIAlertController

醉酒当歌 提交于 2019-12-12 09:53:17
问题 I am trying to put a custom view inside a UIAlertController . I'm running into some odd issues with the sizing of the custom view. I want the custom view to span the width of the UIAlertController , whatever that might be. I'm using CGRectGetWidth(alertController.view.bounds) to get the width of the alert controller. However, this seems instead to be returning the width of the entire view. using view.frame does not make a difference. UIAlertController *alertController = [UIAlertController

Disable Alert Button when Text Field is Null with Swift 3

空扰寡人 提交于 2019-12-12 04:19:50
问题 I would like to disable the alert button when the text box is null. I put the button in Table View Cell. So, when you click that button, the alert box will pop up. My codes are below. func cellTapped(cell: DeviceListTableCell) { self.showAlertForRow(row: tableView.indexPath(for: cell)!.row) } func showAlertForRow(row: Int) { let alert = UIAlertController( title: "Enter Password !!!!!", message: "", preferredStyle: .alert) alert.addTextField { (textField) in } let okAction = UIAlertAction

UIAlertController: textfield not returning string

久未见 提交于 2019-12-12 03:55:34
问题 There is something unexpected I cannot sort out. I have an alertController with textfields . I try to get the string value of one of them. Everything works fine when the string length is less than 11 characters. Above this threshold, the string is null . Could anyone give me a hint on what there is going on? Just in case, I put my code below: [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.placeholder = @"Name"; textField.textColor = [UIColor

How to display an alert when app launches

岁酱吖の 提交于 2019-12-12 03:33:35
问题 I want to present an alert when my app launches for the first time that day. I think the place to do this is the appDelegate (correct me if i am wrong). I have two problems, one: i don't know which of the functions in the appDelegate the function should reside under (have currently chosen just func application), and second: i don't know how to present the alertController to the view that is open. Thus far i have done this func application(application: UIApplication,

Html file inside an AlertController?

我是研究僧i 提交于 2019-12-12 03:28:11
问题 Can I display the contents of an html file inside an UIAlertController? I have a text for a terms of service and I already have it formatted within an html file. I would like to be able to display this in an AlertView when the user enters the app, so that they would have to click Ok. 回答1: You can use Modal Instance in which you can render the complete html page. https://angular-ui.github.io/bootstrap/ 来源: https://stackoverflow.com/questions/36361640/html-file-inside-an-alertcontroller

Creating UIAlertController without presenting it produces warning

人盡茶涼 提交于 2019-12-12 02:34:28
问题 When creating a UIAlertController without presenting it, a warning is printed in the console. Why is this so? override func viewDidLoad() { super.viewDidLoad() let _ = UIAlertController(title: "title", message: "message", preferredStyle: .Alert) } Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior Edit: Is this warning safe to ignore? If the UIAlertController is already created and I decide to not present/use it what

Swift - size of textfield on UIAlertcontrller

孤人 提交于 2019-12-12 00:05:24
问题 I want to increase the initial height of UITextField on UIAlertController. Here is my code: let reportAlertController = UIAlertController(title: "Report", message: "If you find anything to report, please write it in the text box below and press send. To cancel report, press cancel.", preferredStyle: .Alert) reportAlertController.addTextFieldWithConfigurationHandler({ (tf) -> Void in tf.frame.size.height = 1500 tf.placeholder = "Report detail(s) here" }) reportAlertController.addAction

iOS UIAlertController code flow control

我只是一个虾纸丫 提交于 2019-12-11 20:23:56
问题 -(bool)textFieldShouldClear:(UITextField *)textField { UIAlertController * blert = [UIAlertController alertControllerWithTitle:@"your alert" message:@"are you sure you want to clear" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction * defautact = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action){ NSLog(@"tao on YES"); // click= YES; _baba =@"yes"; }]; UIAlertAction * defautact1 = [UIAlertAction actionWithTitle:@"cancel" style