uialertviewdelegate

iOS 7: UIAlertView created in UIActionSheet delegate function cannot auto rotate

陌路散爱 提交于 2019-12-22 18:10:56
问题 The issue only can be reproduced in iOS 7. In the delegate function: - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex , if a UIAlertView is created, the alert view cannot auto rotate. Here is the sample code: - (IBAction)buttonTapped:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"action sheet" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"ok" otherButtonTitles:nil]; [actionSheet showInView:self

How can I perform the handler of a UIAlertAction?

a 夏天 提交于 2019-12-22 08:44:29
问题 I'm trying to write a helper class to allow our app to support both UIAlertAction and UIAlertView . However, when writing the alertView:clickedButtonAtIndex: method for the UIAlertViewDelegate , I came across this issue: I see no way to execute the code in the handler block of a UIAlertAction . I'm trying to do this by keeping an array of UIAlertAction s in a property called handlers @property (nonatomic, strong) NSArray *handlers; and then implement a delegate like such: - (void) alertView:

UIAlertView crash issue on another view controller

倖福魔咒の 提交于 2019-12-13 21:59:14
问题 I have 2 view controllers, ViewController 1(VC1) and 2(VC2). In VC2 I have a back and done button. On clicking back button it goes directly to VC1 and on done it makes an api call and when it gets a response it shows an alert view and clicking ok goes back to VC1. Now when I make a api call a loading bar shows up and disappears when I get response and shows the AlertView . But if during that fraction of second when the loading disappears and AlertView is going to be popped up if I click on

UIAlertview Delegate Method not calling in Child View Controller

拥有回忆 提交于 2019-12-13 11:01:50
问题 I have two controllers VC A -> Parent and VC B -> Child Alert view delegate method i.e func alertView(View: UIAlertView!, clickedButtonAtIndex buttonIndex: Int){} is declared in VC A . When i display alert from VC B delegate method is not called on alert button clicked. 回答1: protocol alertViewDelegate:class { func alertView(View: UIAlertView!, clickedButtonAtIndex buttonIndex: Int) } Create an alert view delegate object in parent class VC A weak var delegate:alertViewDelegate() ?= nil

How to show an alert when turn off bluetooth in Swift app?

℡╲_俬逩灬. 提交于 2019-12-13 02:54:39
问题 The question could be duplicated, but I have tried a lot of code and it wasn't work. I have read about CBCentralManagerOptionShowPowerAlertKey option and the possibility to show an alert to go settings bluetooth option into iPhone for turn on on the application, but I haven't get works this. If I set the key to true the key not appear, and when I change the value to false the key not works... I'm using this code into my Swift application: var bCentralManger: CBCentralManager! self

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 =

iOS 7: UIAlertView created in UIActionSheet delegate function cannot auto rotate

一笑奈何 提交于 2019-12-06 13:56:40
The issue only can be reproduced in iOS 7. In the delegate function: - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex , if a UIAlertView is created, the alert view cannot auto rotate. Here is the sample code: - (IBAction)buttonTapped:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"action sheet" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"ok" otherButtonTitles:nil]; [actionSheet showInView:self.view]; } - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

How can I perform the handler of a UIAlertAction?

房东的猫 提交于 2019-12-05 15:13:09
I'm trying to write a helper class to allow our app to support both UIAlertAction and UIAlertView . However, when writing the alertView:clickedButtonAtIndex: method for the UIAlertViewDelegate , I came across this issue: I see no way to execute the code in the handler block of a UIAlertAction . I'm trying to do this by keeping an array of UIAlertAction s in a property called handlers @property (nonatomic, strong) NSArray *handlers; and then implement a delegate like such: - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { UIAlertAction *action = self

Can you create anonymous inner classes in Swift?

一个人想着一个人 提交于 2019-12-05 01:47:32
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 = UIAlertViewDelegate() { func alertView(alertView: UIAlertView!, clickedButtonAtIndex buttonIndex: Int) { // Handle the

clickedButtonAtIndex method is not called

安稳与你 提交于 2019-12-02 18:28:14
问题 when the user click on a button on the UIAlertView the clickedButtonAtIndex method is supposed to be called, however, it doesn't : in the .h i have called the UIAlertView protocol : @interface RechercherViewController : UIViewController<UIAlertViewDelegate> { //code } and in .m file i have this : -(void)requestFailed:(ASIHTTPRequest *)request { //quand il y aura un échec lors de l'envoie de la requête UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"TopStation" message :@"Your internet