uialertview

Can you create anonymous inner classes in Swift?

岁酱吖の 提交于 2019-12-10 01:59:06
问题 I'm tired of declaring entire classes as having the ability to handle UIAlertView clicks by making them extend UIAlertViewDelegate . It starts to feel messy and wrong when I have multiple possible UIAlertView s, and have to distinguish which was clicked in the handler. What I really want is to create a single object that implements the UIAlertViewDelegate protocol, and give this one-off object to my UIAlertView when showing it. I want something like this: let confirmDelegate =

How to rotate UIAlertController in Swift

故事扮演 提交于 2019-12-09 17:04:50
问题 I have a working UIAlertController , but I want to rotate the alert.view by 90 degrees left. How can I do it? My code is here below: let alert = UIAlertController(title: "", message: "Message Sample", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Okay", style: .Default){(action)->() in }) presentViewController(alert, animated: true) {} I tried to add: alert.view.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2)) but it doesn't work. Thank you ! 回答1: With this code: let

Keyboard will appeared automatically in ios 8.3 while displaying alertview or alertcontroller

梦想与她 提交于 2019-12-09 09:37:13
问题 I have updated Xcode 6.3 and ios8.3 check my code. then it gives me weird result. here is first screen of my demo app. here is one textfield. when I type somethin in textfield keyboard open. after typing completed. I have clicked on show alert button. I have displayed alert and output will be following. After click on cancel. I have displayed another alert then weird result keyboard should not open but when click on cancel button. display another alert and keyboard will appear automatically.

Gray out view in iphone, how?

房东的猫 提交于 2019-12-09 04:24:26
问题 I wonder what is the way to gray out portion of a view similar to the way UIAlertView grays out everything except the message box? Right now i use another custom view on top of the target area, but it doesnt look as nice. Any ideas? 回答1: I get good results using the method you have already tried. perhaps fiddling around with the alpha is a good idea? mask = [[UIView alloc] initWithFrame:window.frame]; [mask setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.78]]; [self.view addSubview

UIAlertView: UIAlertViewStyleSecureTextInput: Numeric keyboard

有些话、适合烂在心里 提交于 2019-12-09 02:23:27
问题 I'm currently using this UIAlertView to do a login popup, UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Restricted" message:@"Please Enter Code to Enable Fields" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login" , nil]; alert.alertViewStyle = UIAlertViewStyleSecureTextInput; [alert show]; However I would like the text input to be a numeric keyboard instead of the regular keyboard Is there a easy way to do this, or do I have to look into creating a custom

when user click on particular date a alert will show with that event title

老子叫甜甜 提交于 2019-12-09 01:56:30
I'm Using SAcalendar. this is my json: data: - [ - { id: "1", event_start: "2014-06-09 11:30", event_end: "2014-06-09 12:30", title: "Click a date to create a new event and drag to change its date and time. Click on an existing event to modify. Click "Show Standard Settings" to set additional event properties." }, - { id: "2", event_start: "2017-01-03 16:30", event_end: "2017-01-03 17:30", title: "fgdgf" }, - { id: "3", event_start: "2017-01-11 03:30", event_end: "2017-01-11 06:00", title: "fdfgdg" },]} now when user click on particular date A alert will show with that event title. this is my

'UIAlertView' was deprecated in iOS 9.0. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead

感情迁移 提交于 2019-12-08 22:56:46
问题 I have see more so answers , but nothing helped.Here is my older alert and action for that override func viewWillAppear(animated: Bool) { if Reachability.isConnectedToNetwork() == true { print("internet connection ok") } else { print("internet not ok") let alertView: UIAlertView = UIAlertView(title: "Alert ", message: "connect to internet", delegate: self, cancelButtonTitle: "settings", otherButtonTitles: "cancel") alertView.show() return } } func alertView(alertView: UIAlertView,

After iOS 8, can I continue to use UIActionSheet and UIAlertView?

 ̄綄美尐妖づ 提交于 2019-12-08 19:10:42
问题 I have apps which use UIActionSheet and UIAlertView . In iOS8, Apple's documentation and some websites say that they are deprecated in iOS8. UIActionSheet documentation Important: UIActionSheet is deprecated in iOS 8. (Note that UIActionSheetDelegate is also deprecated.) To create and manage action sheets in iOS 8 and later, instead use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet. But in Xcode 6 with deployment target 8.0 does not generate warning for the use

IOS: two UIAlert with two different delegate methods

蹲街弑〆低调 提交于 2019-12-08 17:07:35
问题 I have an UIAlert UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ok" message:@"Canc?" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Annul", nil]; [alertView show]; [alertView release]; and its delegate method: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if(buttonIndex == 0)//OK button pressed { //do something } else if(buttonIndex == 1)//Annul button pressed. { //do something } and it's all ok but if I have another

Quit iOS Application Programmatically with UIAlertView

允我心安 提交于 2019-12-08 13:52:44
问题 I'm aborting my iOS Application by below methods -(void)cancelSelected { UIAlertView * alert = [[UIAlertView alloc] initWithTitle:nil message:@"Are you sure you want to exit?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil]; [alert show]; alert = nil; } Method 1 : -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex) abort(); } Method 2 : -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger