willMoveToWindow is called twice
问题 I'm swizzling willMoveToWindow: and I came across an issue where it was being called twice on views. When a new view controller is pushed onto a UINavigationController , willMoveToWindow: is called on the existing view with nil value (Makes sense since the view is moving offscreen) After that time, the method willMoveToWindow: is called again , but now with with the original window. My initial thought is that swizzling and calling the window property before the original method has kicked in.