uialertview

Displaying UIAlertView after some time

[亡魂溺海] 提交于 2019-12-01 01:40:08
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 cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } ); Also, I read that

create alert function in all view controllers - swift

被刻印的时光 ゝ 提交于 2019-12-01 00:47:37
I'm trying to declare a function for showing alerts in my app. To avoid repeating work, i'm trying to use same function for all my app. I tried to do that by creating a class with function showNotification. but when i create an object of that class and call the method, nothing happens. How can i do that? class SharedPropertiesAndMetods : UIViewController { func showNotification(title: String, message: String) { let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) let defaultAction = UIAlertAction(title: "تائید", style: .default, handler: nil)

Delay when updating view in the completionHandler of an async HTTP request

老子叫甜甜 提交于 2019-11-30 23:20:00
In my app when the user presses a button I start a HTTP asynchronous request (using [NSURLConnection sendAsynchronousRequest...] ) and change the text of UILabel in the completionHandler block. This change, however, does not take place when the request is concluded and instead happens around 2-3 seconds later. Below is a code snippet that results in this behavior. - (IBAction)requestStuff:(id)sender { NSURL *url = [NSURL URLWithString:@"http://stackoverflow.com/"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease]

Display Alert Message from viewDidLoad

落爺英雄遲暮 提交于 2019-11-30 22:36:51
问题 I want to display a alert message from viewDidLoad() method of ViewController.m instead from viewDidAppear() method. Here is my code : - (void)viewDidLoad { [super viewDidLoad]; //A SIMPLE ALERT DIALOG UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"My Title" message:@"Enter User Credentials" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") style

UIAlertView with 3 buttons hides message in landscape mode

独自空忆成欢 提交于 2019-11-30 21:48:38
My UIAlertView has a message and 3 buttons, my problem is the alert view display normally in portrait but it hides message in landscape mode as below screenshots. How to make the message appears? Thanks in advance. I too got same problem, But I solved this, with a small change. like add "\n\n" at the end of Title in the alertView This is not a correct solution. but this will rectify that problem some what. *Note : The Title and the Message should be of one line text. Thanks, Satya By merging the Title String into the Message String you can fit two lines of landscaped text. Localization wise,

Change font size for UIAlertView in iOS7

。_饼干妹妹 提交于 2019-11-30 20:59:03
问题 I want to change the font size of message text and title text in alertView. There is no documentation in apple site that speaks about this but apple says "The UIAlertView class is intended to be used as-is" in their subclassing notes. Please refer the below link. https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html I am really confused if changing an alert view text size is something to be avoided or can it be changed? Can anyone

Rotating a UIAlertView

北战南征 提交于 2019-11-30 19:59:19
I've created a custom UIAlertView (by subclassing it and messing around with its show function) that has some custom subviews and is of non-standard size. It works ok when I create and display it, however, when the device is rotated, the alert rotates and then returns to its default size. Any ideas what functions to override - or should I tweak the UIViewController? thanks, Peter Not sure if force rotating the UIAlertView fits the Apple GUI guidelines, but you can rotate it by defining the status bar (status bar and UIAlertView sticks together) application.statusBarOrientation =

UIAlertView with Two TextFields and Two Buttons

妖精的绣舞 提交于 2019-11-30 19:19:27
Problem - I want a UIAlertView which contains a Title, two textfields with placeholders and two buttons. What I have done till now - I have used this code, I am getting the exact UIAlertView with all these I have mentioned but when the view is getting loaded is seems to appear in the bottom first and then comes into the middle of the view. -(void)showalert{ disclaimerAgreedAlertView = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login", nil]; userNameTextField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 15.0, 245.0

Why doesn't dismissWithClickedButtonIndex ever call clickedButtonAtIndex?

别来无恙 提交于 2019-11-30 17:41:38
http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html I'm using that code to get my iPhone app to display an alertView with an included UITextField and matching CANCEL and OK buttons. The user can enter text, hit CANCEL or OK... and I see the text the user entered... using my code inside the clickedButtonAtIndex method. It all works except for 1 thing: Instead of OK, the user might hit DONE on the keyboard. I'm using dismissWithClickedButtonIndex to simulate an OK click... but then clickedButtonAtIndex never gets called. Shouldn't dismissWithClickedButtonIndex also call

UIAlertView with 3 buttons hides message in landscape mode

一曲冷凌霜 提交于 2019-11-30 17:07:12
问题 My UIAlertView has a message and 3 buttons, my problem is the alert view display normally in portrait but it hides message in landscape mode as below screenshots. How to make the message appears? Thanks in advance. 回答1: I too got same problem, But I solved this, with a small change. like add "\n\n" at the end of Title in the alertView This is not a correct solution. but this will rectify that problem some what. *Note : The Title and the Message should be of one line text. Thanks, Satya 回答2: