我在使我的应用程序与 iPad 兼容时遇到问题。
我有一个自定义选项卡栏的实现,基于这里的帖子 http://www.wiredbob.com/blog/2009/4/20/iphone-tweetie-style-navigation-framework.html
除了设备处于关闭状态外,一切正常旋转。当前选定的视图可以完美旋转和调整大小。所有其他视图都会旋转,但不会调整大小以填充空间。右手边有一根巨大的白色柱子。
我尝试添加
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view.autoresizesSubviews = YES;
到选项卡控制器视图。
我已将类似的代码添加到选项卡的视图 viewDidLoad 方法中。
我尝试让 willRotateToInterfaceOrientation 调用所有子视图旋转方法,但仍然没有成功。
在此阶段,任何建议都将受到欢迎。我希望我没有忽略一些显而易见的事情,但我可能会忽略。我已经研究了几个小时了
屏幕截图 1 -
I'm having problems making my app iPad compatible.
I have an implementation of a custom Tab Bar, based on the post here http://www.wiredbob.com/blog/2009/4/20/iphone-tweetie-style-navigation-framework.html
That all works fine apart from when the device is rotated. The currently selected view rotates and resizes perfectly. Every other view rotates but does not resize to fill the space. There is a large white column down the right hand side.
I've tried adding
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view.autoresizesSubviews = YES;
to the tab controller view.
I've added similar code to the tab's views viewDidLoad methods.
I've tried to make the willRotateToInterfaceOrientation call all the subviews rotation methods but still no luck.
Any suggestions would be more than welcome at this stage. I'm hoping i'm not overlooking something obvious but i might be. I've been at it for a few hours now
Screenshot 1 -
Screenshot
发布评论
评论(1)
好的我解决了这个问题。
我所要做的就是手动对所有子视图调用调整大小。 - 我向每个子视图添加了一个changeFrameSize函数(只是为了让代码看起来更好一点)
哦,当添加视图作为子视图时总是使用belowSubView方法 -
所以因为选定的视图控制器总是旋转并调整大小到正确的大小,一旦旋转和调整,我只需将相同的参数传递给子视图,这样它们也会调整大小。
Ok I Solved this problem.
What I had to do was manually call a resize on all the sub views. - i added a changeFrameSize function to each sub view (just so it made the code look a little nicer)
Oh and when adding views as sub views always use belowSubView method -
So because the selected view controller was always rotated and resized to the correct size, once it had rotated and adjusted i simply passed the same parameters to the sub views so they would resize too.