Xcode 4.6.2中的iphone模拟器中按钮无法正确显示 [英] button not displaying correctly in iphone simulator in Xcode 4.6.2

查看:52
本文介绍了Xcode 4.6.2中的iphone模拟器中按钮无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序视图如下:

My application view looks like this:

但是当我运行模拟器时,由于某些原因,它会显示如下:

But when I run simulator, it displays like this for some reason:

您可以看到最后一行中的三个 UIButton 不能正确显示.我不确定这里到底发生了什么.

As you can see the three UIButtons in the last row are not displaying correctly. I am not sure what exactly is going on here.

我在做什么:

  • 我通过遵循CS193 Stanford iTunes U课程来创建RPN计算器.我使用的按钮是普通的 UIButton s,它们作为 action s链接到控制器.

  • I am creating an RPN calculator by following the CS193 Stanford iTunes U course. The buttons I am using are plain UIButtons, they are linked to the controller as actions.

我不是通过代码创建这些按钮,只是将它们拖放到视图中.

I am not creating these buttons through code, they are simply dragged into the view.

我通过双击它们来更改按钮上显示的文本.(我不确定这是否会有所帮助,但我只是提供了此信息,以防万一)

I changed the text displaying on the button by double clicking on them. (I am not sure if this will help but I just provided this information in case it's helpful)

似乎只发生在最后一行的按钮上,因为如果我从上到下拖动另一个按钮,文本也会消失.

It seems to be happening only to the buttons at the last row, since if I drag another button from the top to the bottom, the text will disappear as well.

我的想法:这可能与iPhone 5和iPhone 4/4s的屏幕尺寸差异有关吗?似乎故事板为我提供了iPhone 5大小的屏幕,但是模拟器正在模拟iPhone 4大小的屏幕.

My thought: could it be related to the screen size difference of iPhone 5 and iPhone 4/4s? It seems that the storyboard gives me a screen of the size of an iPhone 5, but simulator is simulating an iPhone 4 sized screen.

直到我决定将Enter按钮的大小调整为当前大小的两倍之前,这种情况才发生.发生这种情况后,我将输入按钮的大小调整为原始大小,即以下图片中显示的大小,但这并不能解决问题.

This was not happening before until I decided to resize the enter button to twice the size it is right now. After that happened, I resized enter button to it's original size, which is what is displaying in the pictures below, but that did not fix the problem.

我尝试将情节提要更改为3.5尺寸,但这并不能解决问题.(实际上,我尝试了所有组合,包括不应该使用的组合,例如3.5分镜脚本+ 4英寸视网膜模拟器等),但没有一个显示正确.

I tried changing the storyboard to 3.5 form factor, but that didn't fix the problem. (In fact, I tried all the combinations, including the ones that shouldn't work, i.e. 3.5 storyboard + 4inch retina simulator, etc.) and none of them is displaying correctly.

提前谢谢!

PS:很抱歉,但对于 仍然 持反对意见的人,您介意先阅读我的问题吗?我已经用我可以提供的所有信息更新了这篇文章.视图不是用代码构建的,因此我不确定是否可以在视图部分提供任何源代码.

PS: I am sorry but for people who are still down voting, would you mind read my question first? I already updated this post with all the information that I can give. The view is not built with code so I am not sure if I can provide any source code on the view part.

推荐答案

自动版式可能会导致此问题.很容易发现:只需在xib/storyboard中关闭自动布局"即可.保存,然后构建并运行.如果可以解决问题,那就够了.

Autolayout might be causing the problem. It's easy to find out: just turn off Autolayout in your xib/storyboard. Save, and build and run. If that fixes it, that was it.

(顺便说一下,我们看到的显然是这三个按钮的文本的底部行.)

(By the way, what we are seeing is clearly the bottom row of the text of those three buttons.)

这篇关于Xcode 4.6.2中的iphone模拟器中按钮无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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