放置在IB中的UI元素在Simulator中向上移动 [英] UI Elements placed in IB appears shifted up in Simulator

查看:135
本文介绍了放置在IB中的UI元素在Simulator中向上移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否在这里丢失了一些东西,但是当我在IB中删除元素(UIImage或UILabel)并在模拟器中运行应用程序时,UI元素正在向上移动一点(如果我将它们放在第一位,则捕捉到状态栏蓝色HIG线)。

I dont know if I am missing something here but when I drop elements (UIImage or UILabel) in IB and run the app in simulator, the UI elements are shifting up a little (Snapping to status bar if I place them at first blue HIG line).

看起来像我忽略的一些设置。这听起来很熟悉吗?请帮忙!

Looks like some setting I am overlooking. Does this sound familiar? please help!

添加了屏幕截图以解释发生了什么......

Added Screenshot to explain whats going on ...


  1. 在Interface Builder中

替代文字http://dl.dropbox.com/u/3093402/Images/IB.png


  1. 在模拟器中

替代文字http://dl.dropbox.com/u/3093402/Images/Simulator.png

推荐答案

好的...这是详细发生的事情 - http://discussions.apple.com/message.jspa?messageID=10861335

Ok ... heres whats happening in detail - http://discussions.apple.com/message.jspa?messageID=10861335

以下是我要解决的问题this - 在视图控制器代码中

And heres what I did to resolve this - In the view controller code

- (void)viewDidLoad {
     CGRect newFrame = self.view.frame;
     newFrame.origin.y += 20;
     self.view.frame = newFrame;
    [super viewDidLoad];
}

只需移动新添加的视图的框架(第一个视图到窗口) 20像素下来,一切都应该很好地适应。这有些如何修复后续视图的视图位置。不知道怎么做?

Just move the frame of the newly added view (first view to the window) 20 pixels down and everything should fit nicely. This some how fixes view position for following views also. Dont know how?

然后你会看到UI元素与你在IB中看到的模拟器和设备中的位置完全相同。

Then you will see the UI elements exactly in the same position in Simulator and Device as you see in IB.

希望这会有所帮助:)

Dev。

这篇关于放置在IB中的UI元素在Simulator中向上移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆