zoukankan      html  css  js  c++  java
  • iOS-UIPickerView

     6.16 UIPickerView

    6.16.1 UIPickerViewDataSource
             // 返回列数
    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
    //返回每列的行数

    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:
    (NSInteger)component;

    6.16.2 UIPickerViewDelegate

    // 返回数据

    - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row 
    forComponent:(NSInteger)component;

    // 返回列宽度

    - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:
    (NSInteger)component;

    //返回行高度

    - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:
    (NSInteger)component;

     

     

    组件_UIPickerView

    <UIPickerViewDataSource, UIPickerViewDelegate>

     - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView //有几列

    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component //每一列行数

    [pickerView reloadComponent:1]; //刷新数据
    /第component列第row行显示什么字符串内容

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

    //每当选择一行就会调用

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component

     / 第component列第row行显示什么样的UIView,用自定义视图填充选择器的内容,view参数是用来性能优化的
    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

    // 返回第component列每一行的高度

    - (CGFloat)pickerView:rowHeightForComponent:
    /手码自定义PickerView时,需要指定显示选择指示器属性
    [picker setShowsSelectionIndicator:YES];
    / 初始化Picker的选项
    [picker selectRow:8 inComponent:0 animated:YES];
  • 相关阅读:
    STL容器[26]
    SHELL[01]
    SHELL[04]
    SHELL[02]I/O重定向
    STL容器[39]
    stl.set用法总结
    STL容器[33]
    STL容器[29]
    hdu acm1071
    hdu acm 2673
  • 原文地址:https://www.cnblogs.com/linxiu-0925/p/5058153.html
Copyright © 2011-2022 走看看