美文网首页
iOS UIActionSheet (点击事件笔记)

iOS UIActionSheet (点击事件笔记)

作者: 赵永洪 | 来源:发表于2015-12-22 18:00 被阅读2530次

//初始化

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"加入黑名单" otherButtonTitles: nil];

[actionSheet showInView:actionSheet];

//代理方法

-(void)showAlert:(NSString *)msg {

UIAlertView *alert = [[UIAlertView alloc]

initWithTitle:nil

message:@"已成功加入黑名单"

delegate:self

cancelButtonTitle:@"确定"

otherButtonTitles: nil];

[alert show];

//实现点击事件

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

{

if (buttonIndex == 0) {

[self showAlert:@"确定"];

NSLog(@"加入黑名单中");

}

}

}

相关文章

网友评论

      本文标题:iOS UIActionSheet (点击事件笔记)

      本文链接:https://www.haomeiwen.com/subject/vdxvhttx.html