用户点击左上角的后退按钮(系统提供)后,
调用父ViewController's
ViewWillAppear
是正确的。
但孩子(正在弹出的那个)也叫!!!! (ViewWillDisappear
在这两个调用之前被调用)这没有意义,何时/为什么会发生这种情况?
用户在孩子ViewController
中进行了一些互动后会发生这种情况。
调用堆栈:
#0 0x003a48c6 in -[MyViewController viewWillAppear:] at MyViewController.mm:103
#1 0x324386fe in -[UIViewController _setViewAppearState:isAnimating:] ()
#2 0x32429ea8 in -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] ()
#3 0x3241c7e8 in __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke ()
#4 0x3241c718 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#5 0x3241c808 in __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke ()
#6 0x3241c718 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#7 0x3241c808 in __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke ()
#8 0x3241c718 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#9 0x3242968a in -[UIView(Internal) _addSubview:positioned:relativeTo:] ()
#10 0x324294de in -[UIView(Hierarchy) addSubview:] ()
#11 0x3250add6 in -[UITransitionView transition:fromView:toView:removeFromView:] ()
#12 0x3250a9e4 in -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] ()
#13 0x3250a44a in __101-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke_2 ()
#14 0x3249d6f4 in _applyBlockToCFArrayCopiedToStack ()
#15 0x3241655a in _afterCACommitHandler ()
#16 0x2fbcd2a4 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#17 0x2fbcac48 in __CFRunLoopDoObservers ()
#18 0x2fbcaf8a in __CFRunLoopRun ()
#19 0x2fb35f0e in CFRunLoopRunSpecific ()
#20 0x2fb35cf2 in CFRunLoopRunInMode ()
#21 0x34a57662 in GSEventRunModal ()
#22 0x3248116c in UIApplicationMain ()
#23 0x000cac10 in main