iPhone开发[四]常用控件之ActionSheet与AlertView(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:12 点击:次
UIAlertView *alert = nil;
if(buttonIndex == [actionSheet destructiveButtonIndex]){//确定
//NSLog(@"确定");
alert = [[UIAlertView alloc]
initWithTitle:@"结果"
message:@"删除完毕"
delegate:self
cancelButtonTitle:@"确定"
otherButtonTitles:nil];
[alert show];
}else if(buttonIndex == [actionSheet cancelButtonIndex]){//取消
NSLog(@"取消");
}
}</span>
方法而,实现clickedButtonAtIndex,在ActionSheet上的按钮被点击时做处理
[cpp]
y:Microsoft YaHei;font-size:18px;">//方法2
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"clickedButtonAtIndex");
UIAlertView *alert = nil;
if(buttonIndex == [actionSheet destructiveButtonIndex]){//确定
//NSLog(@"确定");
//执行删除操作
[self doDelete];
alert = [[UIAlertView alloc]
initWithTitle:@"结果"
message:@"删除完毕"
delegate:self
cancelButtonTitle:@"确定"
otherButtonTitles:nil];
[alert show];
}else if(buttonIndex == [actionSheet cancelButtonIndex]){//取消
NSLog(@"取消");
相关新闻>>
- 发表评论
-
- 最新评论 更多>>