Hi everybody, The following is a sample for launch other program, but I don't know how to launch the Safari when Clicked the "Lanuch Safari" Button after, why auto called the "modalView" method it? thank you very much.
Source Code: #import "LaunchMeAppDelegate.h" @implementation LaunchMeAppDelegate @synthesize window; @synthesize usageAlertView; @synthesize showUsageAlert; - (void)applicationDidFinishLaunching:(UIApplication *)application { showUsageAlert = YES; [self performSelector:@selector(showUsageAlertDialog) withObject:nil afterDelay:0.0]; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { showUsageAlert = NO; if (!url) { return NO; } NSString *URLString = [url absoluteString]; NSString *message = [NSString stringWithFormat:@"The application received a request to open this URL: [EMAIL PROTECTED] Be careful when servicing handleOpenURL requests!", URLString]; UIAlertView *openURLAlert = [[UIAlertView alloc] initWithTitle:@"handleOpenURL:" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [openURLAlert show]; [openURLAlert release]; if (!URLString) { return NO; } NSInteger maximumExpectedLength = 50; if ([URLString length] > maximumExpectedLength) { return NO; } return YES; } - (void)showUsageAlertDialog { if (showUsageAlert) { NSString *message = @"To demonstrate how this application handles a URL request for the new URL type that it registers, enter a URL in Safari that begins the with scheme of the URL type (launchme://) and press the Go button."; self.usageAlertView = [[UIAlertView alloc] initWithTitle:@"Usage" message:message delegate:self cancelButtonTitle:@"Launch Safari" otherButtonTitles:nil]; [self.usageAlertView show]; } } - (void)dismissUsageAlert { [self.usageAlertView dismissWithClickedButtonIndex:-1 animated:YES]; } - (void)modalViewCancel:(UIAlertView *)alertView { [alertView release]; } - (void)modalView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex != -1) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]]; } [alertView release]; } - (void)dealloc { [window release]; [super dealloc]; } @end _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]