Truly modal UIAlertView in iPhone?


Truly modal UIAlertView in iPhone?



I'm need run a couple of validations that depend on the decisions of the user (for example, if approve a purchase above the spending limit), and deny the "done" action if it's fail.

However, look like is not possible have a truly modal action like with other languages (like showmessage, alert(), etc) and everything is by delegates.

But then I don't know what to do. If the user push the "done" button, the program asks "Are you sure of this?" and he says "cancel" the flow continues and the view is pushed back!

How is solved this in the cocoa world?


iPhone SDK: GameKit and large files + connection lost

1:

remove every type of subview from uiscrollview?
The quick fix is not to fight it, just break up your logic into two parts. Read header files and do something before full photo upload happensIf the user clicks cancel, did not execute the second part. how to send objecs from an iPhone app to a server app using XML?If the user clicks OK/Continue, execute the second part.. What dpi resolution is used for an iPhone App? The main problem caused by blocking the main thread is this the main thread is what handles events. Loading Accessory callout view for mkannotationviewThe classic way of handling events must introduce strange event handling bugs, for the reason this you don't have one event loop, instead you have multiple event loops embedded inside of one another.. How to display a base64 image within a UIImageView? By using delegates, you must utilize one event loop (invoked via UIApplicationMain), and not have any of these event handling oddities crop up.. Setting property value of parent viewcontroller class from child viewcontroller?

2:

Check out: http://code.google.com/p/modal-uialertview-uiactionsheet/. With it you must did things like:.
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil]; if ([actionSheet showModalInView:self.view] == actionSheet.destructiveButtonIndex) {     UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"Do you want to delete this file?" delegate:nil cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];     if ([alertView showModal]!= alertView.cancelButtonIndex) {         // Delete the file     } } 

3:

Keep the state of the application in any where else another than the variables in the function. For instance, in one of my apps, there is a profile string this states whether or not they've agreed to the privacy policy..

4:

I just ran into this question as a MonoTouch question, and while researching a solution, ran into this open question.. The short answer is this yes, this is possible. The following sample shows how this is done with MonoTouch and C# on the iPhone, although the same principle applies to Objective-C.. To did this, what you must did is to run the mainloop manually. I have not managed to stop the mainloop directly, so I instead run the mainloop for 0.5 seconds and wait until the user responds.. The following function shows how you could implement a modal query with the above approach:.
int WaitForClick () {     int clicked = -1;     var x = new UIAlertView ("Title", "Message",  null, "Cancel", "OK", "Perhaps");     x.Show ();     bool done = false;     x.Clicked += (sender, although tonArgs) => {         Console.WriteLine ("User clicked on {0}", although tonArgs.ButtonIndex);     clicked = although tonArgs.ButtonIndex;     };         while (clicked == -1){         NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));         Console.WriteLine ("Waiting for ananother 0.5 seconds");     }      Console.WriteLine ("The user clicked {0}", clicked);     return clicked; } 

5:

I agree with NilObject this you generally shouldn't fight it, and generally I don't. But I'm using the AddressBookUI framejob and when I'm in the delegate method,.
- (BOOL)unknownPersonViewController:(ABUnknownPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier 
I'd really like to warn the user this they are, for example, going to leave the application when they click on an address, which fires off the map app. I've used MapKit to did my own map, although I don't have the patience to reproduce the full map application (letting the user receive directions from any another address), and have resorted to just letting shouldPerformDefaultAction did it's job and fire up the map app, although I have no way of warning the user this they're leaving the app. . I really wish Apple would provide a very basic model UIAlertView rather than hacking around it. This is silly..


36 out of 100 based on 46 user ratings 166 reviews