#import <UIKit/UIKit.h>
@interface Picking_Values_with_UIPickerViewViewController : UIViewController <UIPickerViewDataSource>
@property (nonatomic, strong) UIPickerView *myPicker;
@end
- (void)viewDidLoad{
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.myPicker = [[UIPickerView alloc] init];
self.myPicker.dataSource = self; //这句code该怎么理解?
self.myPicker.center = self.view.center;
[self.view addSubview:self.myPicker];
}
简单说,你要做个Picker,既然做了Picker就要显示东西出来,既然要显示东西出来,那么显示什么谁说了算呢?这句话的意思就是你显示什么,我说了算,所以=self