views:

50

answers:

1

What are the consequences of overriding internal UIViewController methods?

[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] is giving me some problems. It resizes my frame to values I do not desire sometimes. I do not even know where it picks off the new frame's values (it is close to the size of the superview to where I am adding it, but is off by 2px). Reference: this question, which I also need some help with.

I tried defining an empty - (void)viewDidMoveToWindow:(UIWindow *)window shouldAppearOrDisappear:(BOOL)flag method in my view controller. Bug is gone. >.<

Does anyone know if overriding -viewDidMoveToWindow:shouldAppearOrDisappear: is ok to do? Or some other workaround?

Or, does anyone know when and why -viewDidMoveToWindow:shouldAppearOrDisappear: likes to change my frame dimensions sometimes?

Thanks in advance.

+2  A: 

If you override that method you run the risk of getting rejected, it is undocumented. An approach that isn't against the rules is to override the setFrame: method of the view in the view controller though.

If you believe this is a bug, put together a minimal test case and submit it to http://bugreport.apple.com and potentially upload it somewhere that we can see exactly what is happening as well.

Joshua Weinberg
App rejection is my main concern. I will try the setFrame override approach.
Altealice
You are awesome. Thanks!
Altealice
I'm still interested to know why viewDidMoveToWindow:shouldAppearOrDisappear: will sometimes try to resize my frame though.
Altealice
I would definitely submit a bug report. I'm not sure why that would be happening.
Joshua Weinberg