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

UIActionSheet 控件

2015-07-28 13:27 363 查看
UIActionSheet 相对来说比较简,下面来看看具体的实际效果,就是要界面上弹出可供用户选择的按钮。



需要实现的技术要点包括:

1:控件的使用直接上代码:固定的模式 定义变量 *action 分配内存空间 UIActionSheet alloc 初使化人内容,设置委托 等。

UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"退出后将退回登录界面" delegate:self cancelButtonTitle:@"退出登录" destructiveButtonTitle:@"取消 " otherButtonTitles:nil, nil ];

[action showInView:self.view];

2:对按钮操作需要实现委托:UIActionSheetDelegate

前面两个是我实现tabelView的委托。



@interface SettingViewController : UIViewController<UIActionSheetDelegate>{

3:实现委托方法

-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{

if(buttonIndex!= [actionSheet destructiveButtonIndex]){

//根据点击不同的按钮实现不同方法。

}

}

到此就完成了一个 UIActionSheet 的过程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: