我刚开始学习IOS开发。我花了几天时间试图解决这个问题,但我一无所获。希望有人可以提供帮助。
我正在为 iPhone 开发一个计算器应用程序(只是为了练习)。我创建了一个按钮网格,但是当我开始创建最后一行时,xCode 在我创建或移动每个按钮后不断崩溃。我最终创建了布局,但是当我运行应用程序时,底行(在 IOS 模拟器或我的 iPhone 上)的任何按钮都没有显示按钮文本:
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| = |
+----+ +----+ +----+ | | +----+
| | | | | | | | | |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
如果我将按钮从底行一一移动到顶行,文本会显示在它们上面,但仍然不在底行:
+----+ +----+ +----+
| . | | +- | | C |
| | | | | |
+----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| = |
+----+ | |
| | | |
| | | |
+----+ +----+
然后,当我将最后一个按钮移到顶部时,新的底行停止显示文本:
+----+ +----+ +----+ +----+
| 0 | | . | | +- | | C |
| | | | | | | |
+----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| |
| |
| |
| |
+----+
然后我向上移动等号按钮,新的底行无法显示文本:
| |
| |
+----+ +----+ +----+ | = | +----+
| 0 | | . | | +- | | | | C |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+
| | | | | | | |
| | | | | | | |
+----+ +----+ +----+ +----+
这真是令人沮丧!我又开始在一个新的应用程序中得到同样的东西,总是没有显示的最低对齐行。如果我切换到 3.5" 视图,问题仍然存在。我尝试将按钮进一步间隔开,尝试更改所有文本参数,更改视图以禁用自动调整子视图并将模式从比例更改为适合,但这仍在发生.我找不到任何其他描述这个问题的帖子,这看起来很奇怪,因为它很容易重新创建。请帮助。