观察UIDatePicker中的更改 [英] Observing change in UIDatePicker

查看:95
本文介绍了观察UIDatePicker中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到没有委托来观察UIDatePicker中的更改。有没有办法检测何时在选择器中进行更改而不确认任何内容,例如它旋转并落在我希望能够检测到的新数字上的那一刻。我考虑过关键值观察,但我不认为有一个属性在现场发生变化

I noticed that there is no delegate to observe changes in UIDatePicker. Is there a way to detect when a change is made in the picker without confirming anything, like the moment it spins and lands on a new number I want to be able to detect that. I thought about key value observing, but I don't think there's a property that changes on the spot

推荐答案

转到IB和从 UIDatePicker 拖动到.h文件。然后选择

Go to IB and drag from the UIDatePicker to your .h file. Then select

然后处理这个你想要的.m文件; XCode将为您添加以下方法。

Handle this however you want in your .m file; XCode will add the method below for you.

这篇关于观察UIDatePicker中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆