From 59ff33b8eb0df2a572464b4ae5652c804967e1a2 Mon Sep 17 00:00:00 2001 From: qtdc1229 Date: Mon, 18 Jan 2016 17:38:21 +0800 Subject: [PATCH] change read me delete some unused --- .../DCPickerRecord/DCPickerRecordModel.h | 2 +- .../DCPickerRecord/DCPickerRecorder.h | 2 +- .../DCPickerRecord/DCPickerRecorder.m | 2 +- DCPickerRecord/ViewController.m | 3 +- README.md | 30 +++++++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/DCPickerRecord/DCPickerRecord/DCPickerRecordModel.h b/DCPickerRecord/DCPickerRecord/DCPickerRecordModel.h index b8f24e6..53c67bf 100644 --- a/DCPickerRecord/DCPickerRecord/DCPickerRecordModel.h +++ b/DCPickerRecord/DCPickerRecord/DCPickerRecordModel.h @@ -66,7 +66,7 @@ @interface DCPickerRecordModel : NSObject -@property (nonatomic ,copy) id (^dc_didSelectedBlock)(); +@property (nonatomic ,copy) void (^dc_didSelectedBlock)(); @property (nonatomic, readonly) NSInteger numberOfComponent; @property (nonatomic, readonly) NSMutableArray *rowOfComponent; diff --git a/DCPickerRecord/DCPickerRecord/DCPickerRecorder.h b/DCPickerRecord/DCPickerRecord/DCPickerRecorder.h index c3454e2..d02cad7 100644 --- a/DCPickerRecord/DCPickerRecord/DCPickerRecorder.h +++ b/DCPickerRecord/DCPickerRecord/DCPickerRecorder.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)shareRecorder; -- (void)dc_pickerView:(nonnull UIPickerView *)pickerView recordDataClass:(Class)dataClass didSelectedAction:(id (^)())didSelectedAction; +- (void)dc_pickerView:(nonnull UIPickerView *)pickerView recordDataClass:(Class)dataClass didSelectedAction:(void (^)())didSelectedAction; @end NS_ASSUME_NONNULL_END diff --git a/DCPickerRecord/DCPickerRecord/DCPickerRecorder.m b/DCPickerRecord/DCPickerRecord/DCPickerRecorder.m index ba813ae..2a140e0 100644 --- a/DCPickerRecord/DCPickerRecord/DCPickerRecorder.m +++ b/DCPickerRecord/DCPickerRecord/DCPickerRecorder.m @@ -42,7 +42,7 @@ + (instancetype)shareRecorder { return __shareDCPickerSourceRecorder; } -- (void)dc_pickerView:(UIPickerView *)pickerView recordDataClass:(Class)dataClass didSelectedAction:(id (^)())didSelectedAction { +- (void)dc_pickerView:(UIPickerView *)pickerView recordDataClass:(Class)dataClass didSelectedAction:(void (^)())didSelectedAction { NSAssert(pickerView, @"pickerView must nonull"); if ([dataClass isSubclassOfClass:[DCPickerRecordModel class]]) { _pickerDataClass = dataClass; diff --git a/DCPickerRecord/ViewController.m b/DCPickerRecord/ViewController.m index a716ff3..cb0d992 100644 --- a/DCPickerRecord/ViewController.m +++ b/DCPickerRecord/ViewController.m @@ -20,9 +20,8 @@ - (void)viewDidLoad { [super viewDidLoad]; [[DCPickerRecorder shareRecorder] dc_pickerView:self.pickerView recordDataClass:NSClassFromString(@"CityPickers") - didSelectedAction:^id(NSIndexPath *index,CityModel *city) { + didSelectedAction:^void(NSIndexPath *index,CityModel *city) { self.label.text = [NSString stringWithFormat:@"选择了 %@省 %@ 市",city.province,city.name]; - return nil; }]; // [self.pickerView reloadAllComponents]; // Do any additional setup after loading the view, typically from a nib. diff --git a/README.md b/README.md index afafdd8..edace01 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,32 @@ # DCPickerRecord Quick recoder for UIPickerView + +##简介 +DCPickerRecord 是用来简化UIPickerView 管理以及使用的组件。 + +以往使用Picker 需要实现UIPicker 的代理, + + +```objective-c +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + NSString *ret = @""; + // ret = 你某一行显示的内容 + return ret; +} + +-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + //选择某一行后的行动 +} + +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + NSInteger ret = 0; + return ret; +} + +-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + NSInteger ret = 0; + return ret; +} +``` + +Picker 的选择记录记录比较混乱。 \ No newline at end of file