How to create an alert box in iphone?

后端 未结 10 2180
我寻月下人不归
我寻月下人不归 2020-12-23 21:30

I would like to make an alert type box so that when the user tries to delete something, it says, \"are you sure\" and then has a yes or no for if they are sure. What would b

10条回答
  •  臣服心动
    2020-12-23 21:44

    To pop an alert message use UIAlertView.

     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Wait" message:@"Are you sure you want to delete this." **delegate:self** cancelButtonTitle:@"Delete" otherButtonTitles:@"Cancel", nil];
    [alert show];
    [alert release];
    

    Once you set the delegate as self you can perform your action on this method

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    

提交回复
热议问题