- (IBAction)buttonPressed{ UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No way" destructiveButtonTitle:@"Yes,I'm sure!" otherButtonTitles: nil]; [actionSheet showInView:self.view]; } - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{ if (buttonIndex != [actionSheet cancelButtonIndex]) { NSString *msg = nil; if (nameField.text.length > 0) msg = [[NSString alloc] initWithFormat:@"you can breathe easy, %@, everything want OK.", nameField.text]; else msg = @"you can breathe easy, everything want OK."; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"something wan done" message:msg delegate:self cancelButtonTitle:@"Phew!" otherButtonTitles: nil]; [alert show]; }
IOS: Yes,No (对话框)
最新推荐文章于 2021-05-24 22:37:55 发布