I have no idea what MessageDlg() , but you can, of course, subclass UIAlertView and handle the response of the dialog based on which the button was clicked, for example:
Set the title of the subclass of UIAlertView :
// // ARReachabilityAlertView.h // #import <UIKit/UIKit.h> @interface ARReachabilityAlertView : UIAlertView <UIAlertViewDelegate> { } @end
Configure the implementation of the UIAlertView subclass:
// // ARReachabilityAlertView.m //
Note the delegate method alertView:clickedButtonAtIndex: This handles the conditional expressions that you use to decide how the application runs. You can send NSNotification from here or call the application’s deletion method, whatever you want.
In my example, this UIAlertView is created if there is no network connection, and the application closes if the user clicks the Exit button in the alert view. Otherwise, if the user clicks "Continue", the application continues to work as usual.
Note that to implement the subclass, you must call the drawRect: method. I'm not sure if this is a mistake or not, as I expect the drawRect: method to be called in the superclass; I filed a bug report with Apple, but I didn't hear anything. Comment on this if you want to see what effect will be - this is interesting.
source share