我正在尝试更新已传递通知(警报)的副标题中的字符串,我正在这样做NSTimer
:
[NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(updateSubtitle)
userInfo:nil
repeats:YES];
- (void)updateSubtitle
{
[[NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications
enumerateObjectsUsingBlock:^(NSUserNotification *notification, NSUInteger idx, BOOL *stop) {
notification.subtitle = @"new subtitle";
}];
}
代码每 5 秒正确执行一次。但是通知警报中显示的字幕不会改变。
有什么方法可以强制“重绘”setNeedsDisplay
或类似的东西吗?
谢谢。