如何代码实现点击按钮弹出pickerview,并把选择的值穿到fieldtext中
展开全部
简单写了点代码,就这样
self.pick = [[UIPickerView alloc] init];
self.pick.dataSource = self;
self.pick.delegate = self;
textField.inputView =self. pick;
代理方法
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return self.pickArray.count;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return self.pickArray[row];
}
self.pick = [[UIPickerView alloc] init];
self.pick.dataSource = self;
self.pick.delegate = self;
textField.inputView =self. pick;
代理方法
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return self.pickArray.count;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return self.pickArray[row];
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询