Datepicker单元格的通知(Notification for Datepicker cell)

编程入门 行业动态 更新时间:2024-10-15 12:29:23
Datepicker单元格的通知(Notification for Datepicker cell)

我必须根据我从日期选择器中选择的日期和时间,使用数据库中的值填充nstableview。 当我从“到目前”日期选择器中选择日期和时间时,必须使用值填充表格。 为此,我使用了通知。 在从笔尖醒来的虚空中,

NSNotificationCenter *center = [[NSNotificationCenter alloc] init]; [center addObserver:self selector:@selector(controlTextDidChange:) name:NSControlTextDidChangeNotification object:_toDate]; //_toDate is an ivar

和,

-(void)controlTextDidChange:(NSNotification *)obj { //populating tableview with datas }

我已将日期选择器单元的委托连接到文件所有者。 问题是它根本没有进入controlTextDidChange:方法。 如果我从日期选择器中选择日期和时间,请帮助我填充nstableview一次。 谢谢。

I have to populate the nstableview with values from data base based on the date and time which i select from the date picker. When i select a date and time from the 'To date' date picker, the table has to be populated with values. For this i have used notification. In void awake from nib,

NSNotificationCenter *center = [[NSNotificationCenter alloc] init]; [center addObserver:self selector:@selector(controlTextDidChange:) name:NSControlTextDidChangeNotification object:_toDate]; //_toDate is an ivar

and,

-(void)controlTextDidChange:(NSNotification *)obj { //populating tableview with datas }

and i have connected the date picker cell's delegate to file owner. The problem is it is not at all going into the controlTextDidChange: method. Pls help me to populate the nstableview once if i select the date and time from the date picker. Thanks.

最满意答案

您需要发布这样的通知:

[[NSNotificationCenter defaultCenter] postNotificationName:NSControlTextDidChangeNotification object:_toDate];

在你的选择器选择方法中写下这段代码它会对你有用。

You need to post your notification like this :

[[NSNotificationCenter defaultCenter] postNotificationName:NSControlTextDidChangeNotification object:_toDate];

write this code in you pickers selection methode it will work for you.

更多推荐

本文发布于:2023-08-04 02:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405476.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   通知   Datepicker   Notification   cell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!