상세 컨텐츠

본문 제목

[iOS 개발] UIPickerViewDataSource Protocol Reference

헉!!/iOS

by 권태성 2011. 9. 14. 21:22

본문


UIPickerViewDataSource Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 2.0 and later.
Declared in
UIPickerView.h
Related sample code

Overview

The UIPickerViewDataSource protocol must be adopted by an object that mediates between a UIPickerView object and your application’s data model for that picker view. The data source provides the picker view with the number of components, and the number of rows in each component, for displaying the picker view data. Both methods in this protocol are required.

Instance Methods

numberOfComponentsInPickerView:

UIPickerViewDataSource 프로토콜의 필수 메소드로써, 컴포넌트의 수를 반환합니다.

Called by the picker view when it needs the number of components. (required)

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
Parameters
pickerView

The picker view requesting the data.

Return Value

The number of components (or “columns”) that the picker view should display.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIPickerView.h

pickerView:numberOfRowsInComponent:

Called by the picker view when it needs the number of rows for a specified component. (required)

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

The picker view requesting the data.

component

A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.

Return Value

The number of rows for the component.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIPickerView.h

관련글 더보기