2017-03-08 50 views
0

在我的應用程序中,我的行爲不一致,即使在接收到相同的步驟後,有時仍未收到撥號電話MyView有什麼辦法可以告訴是什麼原因將-drawRect:消息發送給NSView?

的事情是,在回溯了drawRect,沒有框架,告訴我什麼是我們的代碼,導致消息被髮送

這裏發生內是一個例子回溯(前2幀不物質):

2 MyApp        0x00000001000112a5 -[MyView drawRect:] + 1429 
3 AppKit        0x00007fff8bfc87be -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] + 1331 
4 AppKit        0x00007fff8bfc8156 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 242 
5 AppKit        0x00007fff8bfc7caf -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 2403 
6 AppKit        0x00007fff8bfc7341 -[NSView(NSLayerKitGlue) drawLayer:inContext:] + 108 
7 QuartzCore       0x00007fff88045b19 CABackingStoreUpdate_ + 3494 
8 QuartzCore       0x00007fff88044d6d ___ZN2CA5Layer8display_Ev_block_invoke + 59 
9 QuartzCore       0x00007fff88044759 _ZN2CA5Layer8display_Ev + 1565 
10 AppKit        0x00007fff8bfc6318 _NSBackingLayerDisplay + 641 
11 AppKit        0x00007fff8bfb8878 -[_NSViewBackingLayer display] + 818 
12 QuartzCore       0x00007fff880364a5 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 603 
13 QuartzCore       0x00007fff88035fcd _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35 
14 QuartzCore       0x00007fff880354a1 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 
15 QuartzCore       0x00007fff880350ec _ZN2CA11Transaction6commitEv + 508 
16 QuartzCore       0x00007fff88040977 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 71 
17 CoreFoundation      0x00007fff88f3efc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 
18 CoreFoundation      0x00007fff88f3ef37 __CFRunLoopDoObservers + 391 
19 CoreFoundation      0x00007fff88f1de58 CFRunLoopRunSpecific + 328 
20 HIToolbox       0x00007fff93726935 RunCurrentEventLoopInMode + 235 
21 HIToolbox       0x00007fff9372676f ReceiveNextEventCommon + 432 
22 HIToolbox       0x00007fff937265af _BlockUntilNextEventMatchingListInModeWithFilter + 71 
23 AppKit        0x00007fff8be5fdf6 _DPSNextEvent + 1067 
24 AppKit        0x00007fff8be5f226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 
25 AppKit        0x00007fff8be53d80 -[NSApplication run] + 682 
26 AppKit        0x00007fff8be1d368 NSApplicationMain + 1176 
27 MyApp        0x000000010000d102 main + 34 
28 libdyld.dylib      0x00007fff8ec5c5ad start + 1 

我只是想弄清楚是否有可能看到什麼消息/事件發生的事情的結果在-drawRect,所以我能看到爲什麼偶爾沒有收到-drawRect

請注意,我已經看到這個線程:How to tell what's causing drawRect to be called?,但它沒有回答我的問題

回答

0

好吧,所以我知道我說前2幀沒關係,但事實證明他們做到了。

只是一個大腦放屁,我已經設置了深度3的堆棧幀,如果我剛剛設置它在drawRect,我會看到它實際上每次我都期待它被調用。在第二個堆棧幀中有一條if語句阻止執行進入我在寫這個問題時打破的頂層堆棧幀T.T

相關問題