pickerView

01-pickerView簡單使用

一.UIPickerViewDataSource

// 返回有多少列- (NSInteger)numberOfComponentsInPickerView:(UIPickerView*)pickerView;// 返回第component有多少行- (NSInteger)pickerView:(UIPickerView*)pickerView numberOfRowsInComponent:(NSInteger)component;

二.UIPickerViewDelegate

// 返回第component列多寬- (CGFloat)pickerView:(UIPickerView*)pickerView widthForComponent:(NSInteger)component

// 返回第component列多高- (CGFloat)pickerView:(UIPickerView*)pickerView rowHeightForComponent:(NSInteger)component

// 返回第component列第row行標題- (NSString*)pickerView:(UIPickerView*)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

// NSAttributedString:富文本,可以描述文本的外觀屬性,顏色,字體,陰影,空心,圖文混排//- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component

// 返回第component列第row行視圖控件- (UIView*)pickerView:(UIPickerView*)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView*)view

// 當用戶選中某一行的時候調用// 選中第component列第row行的時候調用// 可以監聽pickerView滾動- (void)pickerView:(UIPickerView*)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容