티스토리 뷰
UIPickerViewDelegate Protocol Reference
Conforms to | |
Framework |
/System/Library/Frameworks/UIKit.framework
|
Availability | Available in iOS 2.0 and later.
|
Declared in |
UIPickerView.h |
Overview
The delegate of a UIPickerView
object must adopt this protocol and implement at least some of its methods to provide the picker view with the data it needs to construct itself.
The delegate implements the required methods of this protocol to return height, width, row title, and the view content for the rows in each component. It must also provide the content for each component’s row, either as a string or a view. Typically the delegate implements other optional methods to respond to new selections or deselections of component rows.
See UIPickerView Class Reference for a discussion of components, rows, row content, and row selection.
Tasks
Setting the Dimensions of the Picker View
Setting the Content of Component Rows
The methods in this group are marked @optional
. However, to use a picker view, you must implement either thepickerView:titleForRow:forComponent:
or the pickerView:viewForRow:forComponent:reusingView:
method to provide the content of component rows.
Responding to Row Selection
Instance Methods
pickerView:didSelectRow:inComponent:
Called by the picker view when the user selects a row in a component.
Parameters
- pickerView
An object representing the picker view requesting the data.
- row
A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.
- component
A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.
Discussion
To determine what value the user selected, the delegate uses the row index to access the value at the corresponding position in the array used to construct the component.
Availability
- Available in iOS 2.0 and later.
Declared In
UIPickerView.h
pickerView:rowHeightForComponent:
Called by the picker view when it needs the row height to use for drawing row content.
Parameters
- pickerView
The picker view requesting this information.
- component
A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.
Return Value
A float value indicating the height of the row in points.
Availability
- Available in iOS 2.0 and later.
Declared In
UIPickerView.h
pickerView:titleForRow:forComponent:
Called by the picker view when it needs the title to use for a given row in a given component.
Parameters
- pickerView
An object representing the picker view requesting the data.
- row
A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.
- component
A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.
Return Value
The string to use as the title of the indicated component row.
Availability
- Available in iOS 2.0 and later.
Declared In
UIPickerView.h
pickerView:viewForRow:forComponent:reusingView:
Called by the picker view when it needs the view to use for a given row in a given component.
Parameters
- pickerView
An object representing the picker view requesting the data.
- row
A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.
- component
A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.
- view
A view object that was previously used for this row, but is now hidden and cached by the picker view.
Return Value
A view object to use as the content of row. The object can be any subclass of UIView
, such as UILabel
, UIImageView
, or even a custom view.
Discussion
If the previously used view (the view parameter) is adequate, return that. If you return a different view, the previously used view is released. The picker view centers the returned view in the rectangle for row.
Availability
- Available in iOS 2.0 and later.
Declared In
UIPickerView.h
pickerView:widthForComponent:
Called by the picker view when it needs the row width to use for drawing row content.
Parameters
- pickerView
The picker view requesting this information.
- component
A zero-indexed number identifying a component of the picker view. Components are numbered left-to-right.
Return Value
A float value indicating the width of the row in points.
Availability
- Available in iOS 2.0 and later.
Declared In
UIPickerView.h
'헉!! > iOS' 카테고리의 다른 글
[iOS 개발] 네비게이션 타이틀 이름을 지정 (1) | 2011.09.15 |
---|---|
[iOS 개발] UIPickerViewDataSource Protocol Reference (6) | 2011.09.14 |
[iOS 개발] pickerView:numberOfRowsInComponent (0) | 2011.09.14 |
[iOS 개발] TableView를 사용할 경우 행이 선택되었는지 확인해주는 메소드 (1) | 2011.08.04 |
[iOS 개발] IBAction을 사용하여 View 전환하기 (4) | 2011.07.22 |
- Total
- Today
- Yesterday
- iBATIS
- zero
- 오브젝트 C
- 아이폰
- 티스토리챌린지
- Spring Framework
- Java
- SQL
- 자바
- Programming
- JSP
- Objective C
- 오브젝티브 C
- oracle
- Objective-C
- 자바스크립트
- iPhone
- MAC OSX 10.7
- JavaScript
- MySQL
- Object C
- 제이쿼리
- Spring
- jQuery
- 아이폰 개발
- 오블완
- IT
- 아이폰 어플리케이션
- iOS 개발
- tomcat
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |