您的位置:首页 > 产品设计 > UI/UE

UIActionSheet

2016-01-12 22:44 295 查看
UIActionSheet是在iOS弹出的选择按钮项,可以添加多项,并为每项添加点击事件。

-(IBAction)sheetshow:(id)sender{
    UIActionSheet *sheetnow=[[UIActionSheet alloc]initWithTitle:@"相片设置功能" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"相片移除" otherButtonTitles:@"确认", nil];
    [sheetnow showInView:self.view];
}
//代理

<UIActionSheetDelegate>
//代理方法

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"%ld",buttonIndex);
    if (buttonIndex==1) {
        UIImageView *view=[[UIImageView alloc]initWithFrame:self.view.frame];
        view.backgroundColor=[UIColor blackColor];
        [self.view addSubview:view];
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: