Up vote 0 down vote favorite 1 share g+ share fb share tw.
I have discovered that when my program starts, in one of my viewcontrollers the order of calling is viewDidAppear, viewWillAppear, viewDidAppear. I was not expecting the first viewDidAppear to be called. What could be causing this and how do I fix it?
ATM I have a flag in viewDiDAppear to check if viewWillAppear was called, but it's a hack. The stacktrace (which is identical in bot calls to viewDidAppear)is: #0 0x0000509e in -MainView viewDidAppear: at MainView. M:497 #1 0x3097e96e in -UINavigationController navigationTransitionView:didEndTransition:fromView:toView: #2 0x30af3abe in -UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext: #3 0x30af4930 in -UINavigationTransitionView _navigationTransitionDidStop #4 0x3091af0d in -UIViewAnimationState sendDelegateAnimationDidStop:finished: #5 0x3091ba9e in +UIViewAnimationState popAnimationState #6 0x30af46fd in -UINavigationTransitionView transition:fromView:toView: #7 0x30af3b01 in -UINavigationTransitionView transition:toView: #8 0x30979f09 in -UINavigationController _startDeferredTransitionIfNeeded #9 0x30a97d9c in -UILayoutContainerView layoutSubviews #10 0x0040bd94 in -CALayer layoutSublayers #11 0x0040bb55 in CALayerLayoutIfNeeded #12 0x0040b3ae in CA::Context::commit_transaction #13 0x0040b022 in CA::Transaction::commit #14 0x308f942a in -UIApplication _reportAppLaunchFinished #15 0x308fef33 in -UIApplication handleEvent:withNewEvent: #16 0x308fad82 in -UIApplication sendEvent: #17 0x309013e1 in _UIApplicationHandleEvent #18 0x32046375 in PurpleEventCallback #19 0x30245560 in CFRunLoopRunSpecific #20 0x30244628 in CFRunLoopRunInMode #21 0x308f930d in -UIApplication _run #22 0x309021ee in UIApplicationMain #23 0x00001e82 in main at main.
M:14 iphone objective-c cocoa-touch uiviewcontroller viewwillappear link|improve this question edited Oct 30 '10 at 4:32 asked Oct 30 '10 at 0:19John Smith2,68411639 85% accept rate.
Etc – Deniz Mert Edincik Oct 30 '10 at 20:32.
Put a break point in viewDidAppear, then inspect the call stack in the debugger. It will tell you what is calling the method.
I've done that, but they are both coming from main, specifically UIApplicationMain(...) – John Smith Oct 30 '10 at 0:43 Why don't you add the stack traces here. – coneybeare Oct 30 '10 at 4:10.
Sometimes I use this to avoid some methods being called twice or more. NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(viewDidAppear) object:nil.
It's very likely that you want the behavior of viewDidLoad rather than viewDidAppear - viewDidAppear can be called multiple times by your ViewController when you're not expecting it to.
No. I want the viewDidAppear. You are not answering the question I asked.
Again:Why is viewDidAppear being called without a corresponding viewWillAppear? – John Smith Oct 30 '10 at 2:21.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.