在我的 XI 类中发布这样的通知:
[[NSNotificationCenter defaultCenter] addObserver:viewController
selector:@selector(doThis:)
name:@"myNotification"
object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"myNotification" object:nil];
在我的课堂上,我是这样收到的:
- (void) doThis: (NSNotification *) notification {
NSLog(@"It works.");
[uiTextView resignFirstResponder]; }
控制台显示 NSLog 消息,但我的 UITextView 没有隐藏它的键盘。(例如在 viewDidLoad 中 resignFirstResponder/becomeFirstResponder 有效。)
我有什么特别需要做的吗?