如何通过单击textview隐藏PickerView

时间:2014-05-27 11:57:31

标签: iphone uipickerview

如何在选择日期时隐藏选择器?

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{

    countryCodeString = [NSString stringWithFormat:@"+%@",[array_countryCode objectAtIndex:row]];

    [countryCodeButton setTitle:countryCodeString forState:UIControlStateNormal];   
}

2 个答案:

答案 0 :(得分:1)

是的..我得到了我的解决方案

- (void)textFieldDidEndEditing:(UITextField *)textField {

[picker removeFromSupperView];

}

答案 1 :(得分:0)

我们可以隐藏其组件选择的pickerview,如下所示......

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

countryCodeString = [NSString stringWithFormat:@" +%@",[array_countryCode objectAtIndex:row]];

[countryCodeButton setTitle:countryCodeString forState:UIControlStateNormal];

[picker removeFromSupperView]; }