Subview not properly adjusting location on orientation change

时间:2015-08-07 01:37:22

标签: ios objective-c orientation subview orientation-changes

So I decided to add a subview to my parent view, I created a new view and controller, and at runtime I initialize the subview's viewcontroller using initwithnibname to instantiate the view with the nib file. Then I simply make the call to addsubview and the view appears as expected and the subviewcontroller is properly handling all events in that subview... and stuff in the parent view continue to go to the parentview controller.

So, all is well and right with the world....

That is until I change orientation, when I change orientation, the subview does properly rotate itself in terms of its facing landscape or portrait, but it does not change its absolute location in the parent view... it continues to appear at the absolute coordinates it had for the other orientation, and does not adjust as one would expect.

I tried adding the various orientation change events to the subviewcontroller willanimate.. didrotate... but they never get called as the events only seem to go to the parentviewcontroller and do not get passed into subviewcontrollers.

This subview is using constraints, so the nice little autoadjust bars in IB are not there to try to solve this... so how the heck to I set this up so that when the orientation changes, the subviews actual location in the parent view should/must change as well?

0 个答案:

没有答案
相关问题