Monday, 13 June 2016

UIPickerview in iOS - Objective C

1) Drag & Drop UIPickerview and UILabel in to StoryBoard

2) Add Datasource and Delegate Protocols in view controller.h

@interface ViewController : UIViewController <UIPickerViewDelegate,UIPickerViewDataSource>

3) Declare A property in view controller.h 

@property(strong,nonatomic) NSArray *dataSourceArray;

4) Drag & Drop, Datasource and Delegate to ViewController

5) Right Click UIPickerview, Select referencing outlet, drag&drop to view controller.h, name it as picker
6) Right Click Label, Select referencing outlet, drag&drop to view controller.h, name it as resultLabel



7) Add below code in view controller.m

8) Reference Website: http://ioseducation.org/example-use-uipickerview/

http://ioseducation.org/example-use-uipickerview/








No comments:

Post a Comment