uialertview

Displaying UIAlertView after some time

旧时模样 提交于 2019-12-30 07:23:47
问题 I'm trying to display a UIAlertView after some time (like 5 minutes after doing something in the app). I'm already notifying the user if the app is closed or in background. But I want to display a UIAlertView while the app is running. I tried to dispatch_async as follows but the alert is popping forever: [NSThread sleepForTimeInterval:minutes]; dispatch_async(dispatch_get_main_queue(), ^{ UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"title!" message:@"message!" delegate:self

Create UIActionSheet 'otherButtons' by passing in array, not varlist

别来无恙 提交于 2019-12-29 10:12:05
问题 I have an array of strings that I want to use for button titles on a UIActionSheet. Unfortunately, the otherButtonTitles: argument in the method invocation takes a variable length list of strings, not an array. So how I can I pass these titles into the UIActionSheet? The workaround I've seen suggested is to pass nil into otherButtonTitles:, then specify the button titles individually by using addButtonWithTitle:. But this has the problem of moving the "Cancel" button to the first position on

Subclassing UIAlertController

大城市里の小女人 提交于 2019-12-29 08:32:10
问题 With pre-iOS 8 we had to use the UIAlertView and UIActionSheet Which we weren't allowed to mess with the view hierarchy or subclass on either them. UIAlertView Documentation The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified. UIActionSheet Documentation UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more

Highlight Top Button in UIAlertView

橙三吉。 提交于 2019-12-28 16:02:50
问题 I've got a UIAlertView with 3 buttons displayed vertically by default in the UIAlertView. I'd like the top button to be bold/highlighted. From my understanding and testing, the 'cancel' button is the one that is highlighted. The problem is no matter how I set the cancel button, it is placed last in this row. I cannot get it to be the first button. I've tried setting the cancel button explicitly UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:self

Is it possible to lay out 2 buttons vertically on UIAlertView?

淺唱寂寞╮ 提交于 2019-12-28 06:48:07
问题 I want to create UIAlertView with two buttons. I need to lay out these buttons vertically (my text is too big). Is it possible ? Screen1 Screen2 回答1: It's not possible by default. The appearance shown in nycynik's answer is what happens when you have more than two buttons. So, either add another button, or you could look into a third-party solution such as this library, although I have not tested it. 回答2: There seems to be no SDK support for this behavior. Two buttons in a UIAlertView will

Dismissing UIAlertViews when entering background state

扶醉桌前 提交于 2019-12-28 03:20:25
问题 Apple recommends dismissing any UIAlertViews/UIActionSheets when entering background state in iOS 4. This is to avoid any confusion on the user's part when he relaunches the application later. I wonder how I could elegantly dismiss all UIAlertViews at once, without retaining a reference to it everytime I set one up... Any idea ? 回答1: I was intrigued by Dad's answer (funny username :), and curious why it was down-voted. So I tried it. Here is the .m part of a subclass of UIAlertView. Edit:

warning : wait_fences: failed to receive reply: 10004003

旧街凉风 提交于 2019-12-25 18:52:16
问题 I am getting this warning sometimes " wait_fences: failed to receive reply: 10004003 ", do not know why this is coming, I do not have viewdidiappear method in my code, i have a UIAlert in my view, the code is UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Start" message:[NSString stringWithFormat:@"Hi %@,",[user objectAtIndex:0] ] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; 回答1: this is due to UI actions on a view controller on

Check live if UITextField is not empty

徘徊边缘 提交于 2019-12-25 16:44:39
问题 I have a UIAlertView which includes an UITextField. The alert view has tow buttons. One normal "dismiss" button and another "add". The "add" button should just be clickable if the UITextField is not empty. I don't know how to check in "real time" if the field is empty. I only saw the possibility to check the textField if the button has been clicked. But that's not what want ("add" button should be grayed out if thextField is empty). Do you have a solution for this? Thanks for your effort! I'm

Xcode - how to loop a UIAlert (with text field) until a correct value is entered?

久未见 提交于 2019-12-25 05:12:02
问题 I'm currently working in Xcode on an iOS app... I've set up a UIAlertView (with a question as the message ) to pop up with a text field to retrieve a response. The desired functionality is that upon entering an incorrect value into the text field, the UIAlert would loop... Until the correct response is entered. At this point, the UIAlert would be dismissed. I've done extensive google searching and can't come up with a solution... Any responses would be much appreciated! 回答1: Set your class as

UIAlertView keyboard doesn't get shown unless app is re-opened

。_饼干妹妹 提交于 2019-12-25 05:10:02
问题 When the user opens my app, I want to check for a value stored in the defaults, and if it is not present prompt the user to input a value. The storing/reading of the value appears to be working. -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSLog(@"Checking if there is an email address set"); NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString * emailAddress = [defaults objectForKey:@"emailAddress"]; if (IsEmpty(emailAddress)) { NSLog(@"email