首页 > 代码库 > ios自定义选择器ActionSheetPicker改进版
ios自定义选择器ActionSheetPicker改进版
ios自带的UIDataPicker和UIDatePicker最大的毛病就是没有带确定和取消这两个按钮,而ActionSheetPicker是以上两个选择器的开源封装。但是这个东东也有些小问题,就是没有汉化选择器的内容。
原始的ActionSheetPicker运行起来是这个样子的:
改进后是这以下这个样子的
点击此处下载,有问题可加扣扣359709421讨论。
补充一个缺陷的修复,在ios7以上版本中,选择器数据部份是透明的,很不美观,
把AbstractActionSheetPicker.m的showActionSheetPicker方法加上一行
masterView.backgroundColor=[UIColor whiteColor];
即可以解决此问题。
Java代码
- - (void)showActionSheetPicker {
- UIView *masterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.viewSize.width, 260)];
- UIToolbar *pickerToolbar = [self createPickerToolbarWithTitle:self.title];
- [pickerToolbar setBarStyle:UIBarStyleBlackTranslucent];
- [masterView addSubview:pickerToolbar];
- self.pickerView = [self configuredPickerView];
- NSAssert(_pickerView != NULL, @"Picker view failed to instantiate, perhaps you have invalid component data.");
- [masterView addSubview:_pickerView];
- masterView.backgroundColor=[UIColor whiteColor];
- [self presentPickerForView:masterView];
- }
- (void)showActionSheetPicker { UIView *masterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.viewSize.width, 260)]; UIToolbar *pickerToolbar = [self createPickerToolbarWithTitle:self.title]; [pickerToolbar setBarStyle:UIBarStyleBlackTranslucent]; [masterView addSubview:pickerToolbar]; self.pickerView = [self configuredPickerView]; NSAssert(_pickerView != NULL, @"Picker view failed to instantiate, perhaps you have invalid component data."); [masterView addSubview:_pickerView]; masterView.backgroundColor=[UIColor whiteColor]; [self presentPickerForView:masterView];}
我的网店,有劳各位参观参观 http://mrs-x.taobao.com/
- TimCinel-ActionSheetPicker-4d01f72.zip
ios自定义选择器ActionSheetPicker改进版
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。