简体   繁体   English

iphone模拟器只显示背景图片而不是标签和文本框,为什么会这样?

[英]iphone simulator only shows the background images not the labels and text box, why is this?

This is a simple iOS mobile app exercise. 这是一个简单的iOS移动应用练习。 I have a image as a background, and then the labels and text box are added. 我有一个图像作为背景,然后添加标签和文本框。 I run the simulator and it shows correctly. 我运行模拟器,它显示正确。 but after a while I run the simulator again, the simulator only shows the background image, the text box and labels are not there anymore. 但过了一会儿我再次运行模拟器,模拟器只显示背景图像,文本框和标签不再存在。 I restart writing everything many time and the same thing happen at some point. 我重新开始写很多次,同时发生了同样的事情。 This is driving me crazy. 这真让我抓狂。 Did anyone know what is going on here??? 有没有人知道这里发生了什么? Thank you so much in advance for your help!!! 非常感谢你提前帮助!

if you done with story board than your object must be in right order. 如果你完成故事板,你的对象必须正确。

Right/Proper Way 正确/正确的方式

在此输入图像描述

Wrong Way 错误道

在此输入图像描述

I supposed you drag all button , label , text box objects in the storyboard . 我想你在storyboard text box拖动所有buttonlabeltext box对象。 All the thing are supposed to disappear if you do not used any Layout stuff. 如果你没有使用任何Layout东西,所有的东西都应该消失。 Please try AutoLayout . 请尝试AutoLayout

Or if you write the code to show your label in viewDidLoad() , please add the objects to your subview as self.view.addSubview(yourObjects) . 或者,如果您编写代码以在viewDidLoad()显示您的label ,请将对象作为self.view.addSubview(yourObjects)添加到子视图中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM