Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created June 14, 2010 11:18
Show Gist options
  • Save igaiga/437564 to your computer and use it in GitHub Desktop.
Save igaiga/437564 to your computer and use it in GitHub Desktop.
UIButton* button = [[[UIButton alloc] initWithFrame:CGRectMake(150, 240, 100, 30)] autorelease];
[button setBackgroundImage:[UIImage imageNamed:@"btn.png"]
forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"btn_on.png"]
forState:UIControlStateHighlighted];
[button addTarget:self action:@selector(button_pushed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
- (IBAction) button_pushed {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"" message:@"Safariを起動して地図を表示します。よろしいですか?" delegate:self cancelButtonTitle: nil otherButtonTitles:@"Safariを起動", @"キャンセル", nil];
[alertView show];
[alertView release];
}
// AlertViewDelegate
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if(buttonIndex == 0 ) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://igarashikuniaki.net/tdiary/"]];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment