Properties and delegating methods of Uipickerview in iOS

Source: Internet
Author: User

Property

Number of rows for the Numberofcomponents (readonly) selection box

DataSource (readonly) Data source

Delegate delegation

(BOOL) Showsselectionindicator whether to display a selection indicator

This selector refers to the selection box on the Pickerview when sliding:

The transparent rectangle above the Adjara, as shown in the figure, is the indicator.

Delegate method

Uipickerviewdelegate

-(void) Pickerview: (uipickerview*) Pickerview Didselectrow: (nsinteger) Row incomponent: (Nsinteger) component

Select Code to execute on row row of the selection box

-(nsstring*) Pickerview: (uipickerview*) Pickerview Titleforrow: (nsinteger) Row forcomponent: (Nsinteger) component

Text displayed for each line

-(uiview*) Pickerview: (uipickerview*) Pickerview Viewforrow: (nsinteger) Row forcomponent: (Nsinteger) component Reusingview: (UIView *) view

Set the view formatting options for the selection box, which can be uiview and UIView subclasses

This method allows you to set a custom view to replace the default display style for each row

-(CGFloat) Pickerview: (uipickerview*) Pickerview rowheightforcomponent: (Nsinteger) component

Set row height

-(CGFloat) Pickerview: (uipickerview*) Pickerview widthforcomponent: (Nsinteger) component

Set line width

Uipickerviewdatasource

Two of the methods in this delegate are required

-(Nsinteger) Numberofcomponentsinpickerview: (Uipickerview *) Pickerview (required)

Set the number of rows to select in the selection box

It's usually one, and you can choose two or more of them at the same time

Similar to the choice of time, there are about two axes to choose at the same time.

-(Nsinteger) Pickerview: (uipickerview*) Pickerview numberofrowsincomponent: (Nsinteger) component (required)

Set the total number of rows in the selection box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.