The issue: I have a UINavigationController as as subview of UIWindow, a rootViewController class and a custom MyViewController class. The following steps wi
It might be related to both instances of your view controller using the same statically-allocated variable.
In other words, both myViewController_1stInstance
and myViewController_2ndInstance
are using the same variable1
location in memory and overwriting one another.
Variables declared inside of the curly braces after your @interface
definition have a memory location allocated by the runtime for each instance of the class (every time you call [<ClassName> alloc]
. Variables declared in the global scope (that is, outside of any functions or class declarations) are just that: global. That means that the variable can only hold one value per running copy of your application.
There are no truly private variables in Objective-C, but you can hide them from other instances at compile time as described here.
A bit of a late reaction, but I've seen this problem before. Don't push two viewControllers
animated at the same time. Push the first one without animation and push the second one with animation. UINavigationController
can't handle two animations at the same time.