uialertcontroller

showing action sheet in the custom cell in Swift

心不动则不痛 提交于 2019-12-06 14:51:15
I have a custom cell that contains a button inside it, I want to show an action sheet when the button is pressed, but as u know , UITableViewCell is doesn't have the method "presentViewController", so what should I do? In your custom cell's swift file, write a protocol to be conformed by your viewContoller, // your custom cell's swift file protocol CustomCellDelegate { func showActionSheet() } class CustomTableViewCell : UITableViewCell { var delegate: CustomCellDelegate? // This is the method you need to call when button is tapped. @IBAction func buttonTapped() { // When the button is pressed

UiAlertView or UiAlertController to display only once in Swift

两盒软妹~` 提交于 2019-12-06 08:51:14
How can I get my UiAlertController or UIAlertView to display only once in Swift? override func viewDidLoad() { var defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults() if let nameIsNotNill = defaults.objectForKey("name") as? String { self.name.text = defaults.objectForKey("name") as String } if let phoneIsNotNill = defaults.objectForKey("phone") as? String { self.phone.text = defaults.objectForKey("phone") as String } var alert = UIAlertController(title: "Disclaimer", message: "WE STRIVES TO PROVIDE ACCURATE, UP-TO-DATE INFORMATION ON THIS APPS.", preferredStyle:

UIAlertController dismiss is slow

喜你入骨 提交于 2019-12-06 03:49:32
After iOS 8, changing my implementation to UIAlertController instead of UIAlertView is giving me some headaches. The dismissal takes around a full second before the UI becomes responsive after clicking a button. It means users think there's something wrong. Am I the only one suffering from this? It's across several apps, and true for an implementation as simple as this. I tried this in a new blank project. - (IBAction)showAlertView { [[[UIAlertView alloc] initWithTitle:@"test" message:@"test" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; } -(void)alertView:(UIAlertView *

Add image into UIAlertController in swift

落爺英雄遲暮 提交于 2019-12-06 02:43:23
I want to have a simple UIAlertController with image in it. what should I do? let alertMessage = UIAlertController(title: "Service Unavailable", message: "Please retry later", preferredStyle: .Alert) alertMessage.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) self.presentViewController(alertMessage, animated: true, completion: nil) Try this: let alertMessage = UIAlertController(title: "Service Unavailable", message: "Please retry later", preferredStyle: .Alert) let image = UIImage(named: "myImage") var action = UIAlertAction(title: "OK", style: .Default, handler: nil)

UIAlertController textfield width is way smaller than usual

坚强是说给别人听的谎言 提交于 2019-12-06 01:14:35
问题 So I have a UIAlertController with a UITextField added for an input but for some reason the textfield appears to be much smaller than it's supposed to be. Any idea why? Here is the Screenshot Here is the Code UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"This is title" message:@"This is message" preferredStyle:UIAlertControllerStyleAlert]; [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.keyboardType =

Custom View in UIAlertController

爷,独闯天下 提交于 2019-12-05 22:48:00
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 alertControllerWithTitle:@"My Title" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIView *view

Error showing a UIAlertView in swift

好久不见. 提交于 2019-12-05 20:18:31
问题 Im trying to show a UIAlertView in my swift App alert = UIAlertView(title: "", message: "bla", delegate: self, cancelButtonTitle: "OK") alert!.show() => BAD_ACESS error in: -[_UIAlertViewAlertControllerShim initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:] () so I suspected self. I set it to nil alert = UIAlertView(title: "", message: "bla", delegate: nil, cancelButtonTitle: "OK") alert!.show() => ARM_DA_ALIGN error in: -[_UIAlertViewAlertControllerShim initWithTitle

alertController with white borders

ぐ巨炮叔叔 提交于 2019-12-05 14:19:36
I have created an alertcontroller with action sheet and two buttons. As the actionsheet will be having rounded edges, on the screen, on four corners, white color is appearing. I tried changing the background color of the alertcontroller, but that is making the action sheet to rectangular with sharp border instead of rounded borders. I tried setting the view background color to clear color Tried setting the border radius too. Here is my action sheet. I want those white edges invisible. Also, how to change the background color of Cancel. let cancelAction = UIAlertAction(title: "Cancel".localize(

Is it possible to add a hyperlink to a UIAlertController?

 ̄綄美尐妖づ 提交于 2019-12-05 13:01:43
Technology : Objective-C, xCode 7 @property (nonatomic, copy) NSString *notes; @synthesize notes; example.notes = @"Click <a href='http://www.google.com'>here</a>"; NSString *msg = [@"" stringByAppendingFormat:@"%@", myAnnotation.notes]; UIAlertController *alertViewController = [UIAlertController alertControllerWithTitle: @"Title of Alert Box" message: msg preferredStyle: UIAlertControllerStyleAlert]; [alertViewController addAction: [UIAlertAction actionWithTitle: @"Close" style: UIAlertActionStyleCancel handler: nil]]; [self presentViewController: alertViewController animated: YES completion:

UIAlertController not working in iOS 9

我的梦境 提交于 2019-12-05 10:37:38
I have added the UIAlertController code showing login and password textfields, it works for iOS 8 but in iOS 9 not works. The textfields shrinks as shown in figure below The code I am trying is as follows : - (void)toggleLoginLdap:(UIViewController *)currentVC { if ([UIAlertController class]) { self.alertController= [UIAlertController alertControllerWithTitle:@"Title of Msg" message:@"Hello" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action){ NSString *userName = self