如何隐藏选择器视图和日期选择器
我在表视图中使用选择器视图和日期选择器,例如 textfield.inputview=pickerview ..
我想在选择值后隐藏两个视图,我是这样做的:
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
self.paymentText.text=[pickerData objectAtIndex:row];
self.picker.hidden=YES;
}
它隐藏了选择器视图,但是当我再次选择该文本字段选择器视图时不再出现..有人可以帮助我吗?
I am using picker view and date picker in table view like
textfield.inputview=pickerview..
I want to hide both views after selecting value I did it by :
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
self.paymentText.text=[pickerData objectAtIndex:row];
self.picker.hidden=YES;
}
it is hiding picker view but when I again select that textfield picker view does not appear again..Could any one help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否有一行在点击文本字段时触发的行?
您还可以查看 Apple 的 SimpleUndo 示例
Do you have a line which fires when tapping on the text field?
You can also check out the SimpleUndo Example from apple
处理这种文本字段自定义的更好方法是在文本字段编辑开始时添加日期选择器,并在编辑日期选择器视图上的完成或用户按下完成或取消按钮时删除日期选择器视图。
我创建了一个演示,其内容与上述行为相同并且还限制了选择器视图的最小和最大日期。
The better way to handle this kind of customization for text field is to add the date picker when text field editing starts and remove the date picker view when editing the done or user pressed done or cancel button on date picker view.
I have created a demo which contents the same above mentioned behavior and which also restricted to a minimum and maximum date for picker view.