두 개의 경고 단추가 있는데 두 번째 단추를 다른 URL로 가져올 수 없으며 첫 번째 단추와 동일한 URL로 이동합니다. 두 번째 경고가 아무런 문제가 없으면 두 번째 경고의 "방문"버튼이 첫 번째 경고와 동일하게 이동합니다.두 번째 AlertView openURL이 작동하지 않습니다.
-(IBAction)creditBtn: (id) sender{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Credits"
message:@"Message
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Visit", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex==1) {
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:@"http://website1.com"]];
}
}
-(IBAction)sendBtn: (id) sender2{
UIAlertView *alert2 = [[UIAlertView alloc]
initWithTitle:@"Send Me Your Feedback"
message:@"Message"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Visit", nil];
[alert2 show];
[alert2 release];
}
- (void)alertView2:(UIAlertView *)alertView2 clickedButtonAtIndex:(NSInteger)buttonIndex{
// resign the shake FirstResponder, no keyboard if not
//[self resignFirstResponder];
// making the otherButtonTitles button in the alert open a URL
if(buttonIndex==0){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://website2.com"]];
}
}