UIPickerView without IB?
问题 I have my pickerview set up and everything works fine, but right now I have that big pickerview taking up a lot of space in Interface Builder. It's annoying having to move it around when working in Interface Builder. How do I set the pickerview and it's location without using IB? 回答1: Try this: // Add the picker UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,100,0,0)]; [pickerView setDatePickerMode:UIDatePickerModeTime]; [self.view addSubview:pickerView]; [self