ios自訂選取器ActionSheetPicker改進版,iospicker
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