awakeFromNib连续调用

时间:2014-05-23 19:25:08

标签: cocoa nsoutlineview nsscrollview awakefromnib

我在NSView中有一个基于NSOutlineView的视图。当视图显示在我的应用程序中时,outlineview会不断闪烁。 awakeFromNib被重复调用,其中包含[myOutlineView reloadData]。但是,一旦我调整窗口大小(因此视图),闪烁消退并且不再调用awakeFromNib。

我认为闪烁是由awakeFromNib中重复调用reloadData引起的。我无法确定为什么连续调用awakeFromNib。我知道每次NSOutline (here)创建NSTableCellView时都会调用它,但这并不能解释为什么它会被连续调用。

由于在我调整窗口大小后这种行为会停止,我怀疑嵌入了NSOutlineview的NSScrollView,但我现在不知道如何确认这一点,或者更重要的是如何解决它。

那么有人可以就可能导致这种行为的原因给我一些指导吗?

修改

这是在awakeFromNib中断的堆栈跟踪,基于此看起来像创建一个调用awakeFromNib的NSTableCellView,但为什么这样做会持续完成?

    frame #1: 0x00007fff8cfd3b5f AppKit`-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1223
frame #2: 0x00007fff8d077e7c AppKit`-[NSNib _instantiateNibWithExternalNameTable:] + 600
frame #3: 0x00007fff8d19139b AppKit`-[NSNib instantiateNibWithExternalNameTable:] + 17
frame #4: 0x00007fff8d09c278 AppKit`-[NSTableRowData _unarchiveViewWithIdentifier:owner:] + 526
frame #5: 0x00007fff8d09bedd AppKit`-[NSOutlineView makeViewWithIdentifier:owner:] + 48
frame #6: 0x0000000100039c03 Allocator`-[SBRebalanceViewController outlineView:viewForTableColumn:item:](self=0x00006080003c03c0, _cmd=0x00007fff8da60816, outlineView=0x0000000100427ce0, tableColumn=0x000060800009f0e0, item=0x000060000084b580) + 1315 at SBRebalanceViewController.m:146
frame #7: 0x00007fff8d09f964 AppKit`-[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 77
frame #8: 0x00007fff8d09ec97 AppKit`-[NSTableRowData _addViewToRowView:atColumn:row:] + 305
frame #9: 0x00007fff8d09e9ca AppKit`-[NSTableRowData _addViewsToRowView:atRow:] + 191
frame #10: 0x00007fff8d09babe AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 421
frame #11: 0x00007fff8d09b83c AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorRowIndex:inDictionary:withRowAnimation:] + 278
frame #12: 0x00007fff8d09a906 AppKit`-[NSTableRowData _unsafeUpdateVisibleRowEntries] + 1640
frame #13: 0x00007fff8d09a19c AppKit`-[NSTableRowData updateVisibleRowViews] + 230
frame #14: 0x00007fff8d099dc4 AppKit`-[NSTableView layout] + 165
frame #15: 0x00007fff8d098e1d AppKit`-[NSView _layoutSubtreeWithOldSize:] + 325
frame #16: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #17: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #18: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #19: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #20: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #21: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #22: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #23: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #24: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #25: 0x00007fff8d07e584 AppKit`-[NSView layoutSubtreeIfNeeded] + 883
frame #26: 0x00007fff8d746688 AppKit`_NSViewLayoutSubtreesThatUseAutolayoutIfNeeded + 71
frame #27: 0x00007fff8d1097d1 AppKit`-[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 84
frame #28: 0x00007fff8d139d9d AppKit`-[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 214
frame #29: 0x00007fff8d139c86 AppKit`-[NSView _layoutAtWindowLevelIfNeeded] + 80
frame #30: 0x00007fff8d13c3c3 AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 48
frame #31: 0x00007fff8d11c2fa AppKit`-[NSView displayIfNeeded] + 1680
frame #32: 0x00007fff8d18174e AppKit`_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 884
frame #33: 0x00007fff8d757061 AppKit`__83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke1331 + 46
frame #34: 0x00007fff904efe17 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #35: 0x00007fff904efd87 CoreFoundation`__CFRunLoopDoObservers + 391
frame #36: 0x00007fff904e1468 CoreFoundation`__CFRunLoopRun + 776
frame #37: 0x00007fff904e0f25 CoreFoundation`CFRunLoopRunSpecific + 309
frame #38: 0x00007fff91192a0d HIToolbox`RunCurrentEventLoopInMode + 226
frame #39: 0x00007fff91192685 HIToolbox`ReceiveNextEventCommon + 173
frame #40: 0x00007fff911925bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
frame #41: 0x00007fff8cfe526e AppKit`_DPSNextEvent + 1434
frame #42: 0x00007fff8cfe48bb AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
frame #43: 0x00007fff8cfd89bc AppKit`-[NSApplication run] + 553
frame #44: 0x00007fff8cfc37a3 AppKit`NSApplicationMain + 940
frame #45: 0x0000000100007f02 Allocator`main(argc=7, argv=0x00007fff5fbff7f8) + 34 at main.m:13

0 个答案:

没有答案