我想在操作表上单击cancelButtonTitle:时清除所有文本字段;
这是我的操作表代码:
- (IBAction)cancelButtonPressed:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Are you sure?"
delegate:self
cancelButtonTitle:@"No Way!"
destructiveButtonTitle:@"Yes, I’m Sure!"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
}
也许您尚未实现UIActionSheet委托:
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == actionSheet.cancelButtonIndex) {
//Clear textfiled at here
self.firstNameField.text = @"";
}
else{
//Do somethings for @"Yes, I’m Sure!"
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句