iOS 视图演示文稿
我是 iPhone 编程新手,面临着视图问题。
我无法正确地重新表达观点,例如在这种情况下。我有一个底部带有标签栏的 ViewController。该控制器还有其他 4 个控制器,当用户单击图标时我会显示每个控制器。
但是,当主控制器上出现 4 个控制器之一的新视图时,我会在视图下看到一条线。图中是紫色的。 当我改变方向时,该空行出现在同一位置。有时,当我在应用程序中横向输入时,这条线会出现在左侧。
我在这里和IB一起工作。那么,有人可以指出我正确的方向吗? :S
在 shouldAutorotateTo.. 方法上,我有“是”,我是否必须在每次执行该方法时管理视图并更改大小和位置? 我是否必须为每个控制器创建 2 个 NIB,每个方向选项一个?
编辑:我将图片更改为更清晰并显示其他“错误”。
在 1 上,我进入纵向视图。改变它,仍然有磨损线凝视。我所有的笔尖都是纵向的,尺寸为 320 和 480。
在 2 上,我进入横向视图,但笔尖加载为纵向视图。当我改变方向时,它不会按应有的方向扩展。 我该如何解决第二个问题?
我不喜欢每个控制器有 2 个笔尖:S
提前谢谢!
Im new with iphone programming and im facing issues with the views.
I can not respent the view properly, for example in this case. I have an ViewController with a tabbar at the bottom. This controller have other 4 controllers where i show each of them when a user clicks on the icons.
But when a new view from one of the 4 controllers appears on the main controller, i get a line under the view. In the picture is a purple one.
When i change orientation, this empty line appears in the same place. Some times, when i enter with landscape orientation in the app, this line appears at the left.
I'm working here with IB. so, can someone point me here to the right direction? :S
On shouldAutorotateTo.. method i have YES, do i have to manage the views and change size and place every time the method is executed?
do i have to create 2 NIB for each controller, being one for each orientation option??
edit: i changed the picture to be more clear and show other "bug".
On 1 i enter to the view on portrait orientation. change it and still having a wear line up stares. All my nibs are on portrait orientation and 320 and 480 size.
On 2 i enter to the view on landscape but the nib loads as portrait. When i change orientation, it does not expand at it should.
How do i fix this 2nd issue?
i don't fill like having 2 nibs per controller :S
Thx in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的自旋转问题的简短回答:
您可以创建两个笔尖(并在发生自动旋转时在它们之间切换),也可以仅使用一个笔尖。这取决于您的目标。如果您想创建完全不同的视图(例如音乐应用程序在横向上显示封面流,在纵向上显示歌曲),您应该创建两个笔尖。
如果您的视图更像消息应用程序,您可以轻松地仅使用一个笔尖。看一下“Size Inspector”(Xcode 4 中的第 5 个选项卡),红线会引导您。 Xcode 4 界面生成器的 Apple 文档是让您了解该行为的良好开端。
Short answer for Your autorotation problem:
You can either create two nibs (and switch between them, when autorotation occurs), or use just one nib. This depends on your goal. If you want to create a totally different view (like music app shows cover flow on landscape, and song on portrait) you should create two nibs.
If your view is more like the message app you could easily use just one nib. Take a look at the "Size Inspector" (5th tab in Xcode 4), the red lines guide you. The apple documentation for Xcode 4 interface builder is a good start to get you into that behavior.
您视图中的该空间看起来就像 iOS 中状态栏的确切高度,请检查 IB 中的 NIB 以查看您的视图控制器是否有模拟状态栏。如果这样做,请将其关闭,您可能会发现视图的大小不正确。因为它的高度是 460 而不是 480。
That space in your view looks like the exact height of the status bar in iOS, review your NIBs in IB to see if you have a simulated status bar for your view controllers. If you do, turn it off and you will likely see that your view is not sized right. Being that it's height is 460 rather than 480.