上海快风信息科技有限公司

iOS pickView封装(自用)

2016-11-22  本文已影响196人  boundlessocean

pickView

pickView的封装,将数据源与代理抛出

地址:
https://github.com/boundlessocean/pickView.git

使用方法:
1.初始化

    _pickView = [[BLPickerView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150)];
    _pickView.pickViewDelegate = self;
    _pickView.pickViewDataSource = self;
    _pickView.buttonClickedBlock = ^(BOOL isSureButton){
        NSLog(@"%@",isSureButton ? @"确定按钮点击":@"取消按钮点击");
    };
    [_pickView bl_show];

2.实现数据源代理的相关方法提供数据

- (NSInteger)bl_numberOfComponentsInPickerView:(UIPickerView *)pickerView{
}

- (NSInteger)bl_pickerView:(UIPickerView *)pickerView
   numberOfRowsInComponent:(NSInteger)component{
}

- (NSString *)bl_pickerView:(UIPickerView *)pickerView
                titleForRow:(NSInteger)row
               forComponent:(NSInteger)component{
}

- (CGFloat)bl_pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{
}

- (void)bl_pickerView:(UIPickerView *)pickerView
         didSelectRow:(NSInteger)row
          inComponent:(NSInteger)component{
}
上一篇下一篇

猜你喜欢

热点阅读