在发布NSNotification时维护第一响应者

时间:2014-06-15 13:26:48

标签: objective-c cocoa nsnotifications first-responder

在我的应用程序中,我发生了一些后台提取,一旦完成,我发布了一个通知,在侧栏视图(源列表)中更新了一些UI值。但是,每次发布通知时,第一个响应者状态都会更改为主窗口。

  id firstResponder = [[NSApp mainWindow] firstResponder];
            DDLogCWarn(@"The Responder is %@", firstResponder);
//This can be a Tableview, nstextfield...etc.

            [[NSNotificationCenter defaultCenter] postNotificationName:SBChangedAssetValueNotification object:self userInfo:nil];

    id newFirstResponder = [[NSApp mainWindow] firstResponder];
            DDLogCWarn(@"The new responder is %@", newFirstResponder);
//After the notification is called the first responder is the main window itself.

我希望维护第一响应者(通知发布之前),以便用户不会偏离当前任务。我该怎么做?

0 个答案:

没有答案