来自El Capitan的NSTimer的NSAlert和NSWindow(10.11)

时间:2015-10-02 18:18:36

标签: cocoa osx-elcapitan

在更新到El Capitan之后,所有来自NSTimer功能的NSAlerts和NSWindows都是完全白色的(有些报道称全黑,但我不相信那些100%)。没有标题栏,没有按钮,没有文字,只有一个完全白色的矩形。按钮就在那里,如果你点击正确的位置,它们会消失。

在从NSTimer调用的函数中,我执行以下操作:

  MyWindow* wp = [[MyWindow alloc] initWithContentRect:osr
                                      styleMask:styl
                                        backing:NSBackingStoreBuffered
                                          defer:YES];
  ...
  [wp orderFront:nil];
  ...
  [NSApp runModalForWindow:wp];

或者

  alert = [NSAlert alertWithMessageText:nil defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@",ns];

  [alert setAlertStyle:NSWarningAlertStyle];
  [alert setIcon:...];

  switch ([alert runModal]) {

相同的代码已经按预期工作了多年和OS X的版本。当从“sendMessage”(即用户交互)运行时,它仍然有效。是的,这一切都在主线上。

有人知道如何解决这个问题吗?

0 个答案:

没有答案