This is a UIAlertView that has a button linking to this website. It implements the UIAlertView delegate on self.

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"About"
                                                    message:@"Application developed by Kevin Yavno\n\nVersion 1.0"
    [alert show];

This is the implementation of the UIAlertViewDelegate. It’s not the best practice to compare the button title to a hardcoded string, but it gets the job done in this simple app.

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
    if([title isEqualToString:@"Website"])
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @""]];

Leave a Reply

Your email address will not be published. Required fields are marked *