您的位置:首页 > 移动开发 > IOS开发

IOS 开发学习32 actionSheet的使用

2015-06-04 10:17 411 查看

头文件

@interface sheetviewViewController : UIViewController<UIActionSheetDelegate>

@end


弹出actionSheet

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:_str_title
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:nil
otherButtonTitles:nil];

[actionSheet addButtonWithTitle:@"一个选项"];

actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showInView:self.view];


定义重写方法

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex<1)return;
}
- (void)actionSheetCancel:(UIActionSheet *)actionSheet{
NSLog(@"cancel");
}
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
NSLog(@"didDismiss");
}
-(void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex{
NSLog(@"willDismiss");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: