uialertview

UIAlertView with a user supplied context and [self autorelease]

牧云@^-^@ 提交于 2019-12-06 09:56:48
问题 I have looked over some ideas for how to supply a context to a UIAlertView. The common answers are save it in a dictionary or subclass UIAlertView. I don't like the idea of saving the context in a dictionary, it's the wrong place for the data. Subclassing UIAlertView is not supported by Apple, so by my standard, is not a good solution. I came up with an idea, but I'm not sure what to make of it. Create an instance of a context object that is the delegate of UIAlertView. The alert view context

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:

show UIAlertView when In app purchase is in progress

柔情痞子 提交于 2019-12-06 07:05:48
问题 I've added an UIAlertView that has UIActivityIndicatior as a subview on my application. This alertView only show when the purchase is in progress. I've put my alert view in this way in my StoreObserver: - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { for (SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { case SKPaymentTransactionStatePurchasing: [self stillPurchasing]; // this creates an alertView and shows

Any non-private API alternative for this?

我与影子孤独终老i 提交于 2019-12-06 06:19:29
My app was recently rejected due to using a private API ( addTextField: method for UIAlertView , which is quite useful, might I add). Is there any non-private alternative to UIAlertView 's undocumented addTextFieldWithValue:label: ? Thanks SO much in advance! create the text field as a subview of the UIAlertView // Ask for Username and password. alertView = [[UIAlertView alloc] initWithTitle:_title message:@"\n \n \n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; // Adds a username Field utextfield = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25

Multiple UIAlertViews in the same view

和自甴很熟 提交于 2019-12-06 04:39:26
问题 I have two UIAlertViews with ok/cancel buttons. I catch the user response by: - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex The question I'm having is, which alertView is currently open? I have different actions to do when clicking ok/cancel on each one... 回答1: You have several options: Use ivars. When creating the alert view: myFirstAlertView = [[UIAlertView alloc] initWith...]; [myFirstAlertView show]; // similarly for the other alert view(s).

How to Add a UIDatePicker to UIALertView in iOS7

一世执手 提交于 2019-12-06 03:07:50
I have implemented datepicker in one of my view, The way is added the datepicker to the Alertview. Now in iOS 7 i am not able to find the datepicker on the alertview, When searched i have got, we cannot add anything to alertview in iOS7. My requirement was When i will select the DOB textfield, I have to show the Datepickerview and modify the date and the changed value will be stored into the textfield. Now my problem is How can i show the datepicker on the alertview. I have tried showing on the view, but when trying to remove the datpicker from view it is not working. I know this is an older

How do I make a UIAlertView appear only once, at the first start-up of an iPhone app?

此生再无相见时 提交于 2019-12-06 01:29:03
问题 I'm using the UIAlertView to make a pop-up happen once the app has started up. It works fine but I only want the pop up to appear on the first start-up of the app. At the moment I've got the UIAlertView in the AppDelegate class, in applicationDidFinishLaunching method. Here is my code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { sleep(4); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome!" message:@"SAMPLE!!!"

action:@selector(showAlert:) how to pass parameter in this showAlert method?

半腔热情 提交于 2019-12-06 01:01:15
问题 I am adding custom button to my UITableViewCell . In the action of that button I want to call showAlert: function and want to pass cell label in the method. How can I pass a parameter in this showAlert method: action:@selector(showAlert:) ? 回答1: That's not possible. You have to create a method conforming to IBAction - (IBAction)buttonXYClicked:(id)sender; In this method you can create and call the UIAlertView. Don't forget to connect the button with the method in Interface Builder. If you

iphone alertview with textfield

十年热恋 提交于 2019-12-06 00:35:15
问题 I have an UIAlertView with a UITextField in it. I want to type the mail id and submit in UIAlertView 's ok button, but UITextField in the UIAlertView have no response, Please help me. thankz 回答1: From iOS 5 the approach above is no longer necessary. Just set the alertViewStyle property to the appropriate style ( UIAlertViewStyleSecureTextInput , UIAlertViewStylePlainTextInput , or UIAlertViewStyleLoginAndPasswordInput ). Example: UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@

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