iOS Development Uipickerview

Source: Internet
Author: User

1. How to use

Uipickerview use and UITableView are roughly similar. First set Viewcontroller as the data source, then follow the data source protocol < UIPICKERVIEWDATARECOUCE>, and then implement the method in the protocol:

Total number of columns:

-(Nsinteger) Numberofcomponentsinpickerview: (Uipickerview *)

Pickerview;

Section Component column shows how many rows :

-(Nsinteger) Pickerview: (Uipickerview *)Pickerview

Numberofrowsincomponent: (Nsinteger)component;

Above can only set Uipickerview how many rows, how many columns, can not set the data, if you want to display data, you must set Viewcontroller as Uipickerview agent, abide by the proxy protocol <uipickerviewdelegate Then implement the methods in the proxy:

Section Component column, section Row What text is displayed on the line :

-(NSString *) Pickerview: (Uipickerview *)pickerview Titleforrow:

(Nsinteger) row forcomponent: (nsinteger)component;

Section Component Column No. Row what does the line show? View ( content ) :

-(UIView *) Pickerview: (Uipickerview *)pickerview Viewforrow:

(Nsinteger) row forcomponent: (nsinteger)component Reusingview:

(UIView *) View;

checked the Pickerview the first Component Column No. Row Line

-(void) Pickerview: (Uipickerview *)pickerview Didselectrow:

(Nsinteger) row incomponent: (nsinteger)component

iOS Development Uipickerview

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.