在storyboard中拖一个Picker View控件进来,属性保持默认。并给它定义一个变量pickerView1
头文件
//
// PickerViewController.h
// UIViewDemo
//
// Created by dcr on 2016/12/27.
// Copyright © 2016年. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PickerViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>
@end
实现文件
//
// PickerViewController.m
// UIViewDemo
//
// Created by dcr on 2016/12/27.
// Copyright © 2016年. All rights reserved.
//
#import "PickerViewController.h"
@interface PickerViewController ()
@property (weak, nonatomic) IBOutlet UIPickerView *pickerView1;
@property (strong, nonatomic) NSArray *province;
@property (strong, nonatomic) NSArray *guangdong;
@property (strong, nonatomic) NSArray *jiangxi;
@property (strong, nonatomic) NSArray *guangxi;
@property (str