【发布时间】:2012-10-25 18:02:12
【问题描述】:
我在 UIViewController 上有 UIDatePicker。
用户选择日期并在 UIDatePicker 之外单击后,我想隐藏 UIDatePicker 喜欢:
-(void)hidePicker
{
[UIView beginAnimations:@"SlideOutPicker" context:nil];
[UIView setAnimationDuration:0.5];
[_datePicker setCenter: CGPointApplyAffineTransform(_datePicker.center, _datePicker.transform)];
[_datePicker setTransform:CGAffineTransformMakeTranslation(0, 0)];
[UIView commitAnimations];
}
我试试
[_datePicker addTarget:self action:@selector(hidePicker) forControlEvents:UIControlEventTouchUpOutside];
但是事件没有发生,你能给我一些建议吗?
我不想使用 UIControlEventValueChanged,因为 DatePicker 不应在每次用户更改日期时隐藏
【问题讨论】:
标签: objective-c ios uidatepicker uicontrolevents