Reputation: 133
I am just starting out learning IOS development. I've spent days trying to troubleshoot this problem and I'm getting nowhere. Hopefully someone can help.
I was working on a calculator app for the iPhone (just for practice). I created a grid of buttons, but as I started to create the final row xCode kept crashing after I created or moved each button. I eventually got the layout created, but when I run the app the button text does not show for any button on the bottom row (in IOS simulator or on my iPhone):
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| = |
+----+ +----+ +----+ | | +----+
| | | | | | | | | |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
If I move the buttons from the bottom row to the top one by one the text displays on them, but still not on the bottom row:
+----+ +----+ +----+
| . | | +- | | C |
| | | | | |
+----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| = |
+----+ | |
| | | |
| | | |
+----+ +----+
Then, as I move the final button to the top, the new bottom row stops displaying text:
+----+ +----+ +----+ +----+
| 0 | | . | | +- | | C |
| | | | | | | |
+----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 1 | | 2 | | 3 | | | | AC |
| | | | | | | | | |
+----+ +----+ +----+ | | +----+
| |
| |
| |
| |
+----+
Then I move the equals button up, and the new bottom row fails to display text:
| |
| |
+----+ +----+ +----+ | = | +----+
| 0 | | . | | +- | | | | C |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 7 | | 8 | | 9 | | + | | - |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+ +----+
| 4 | | 5 | | 6 | | / | | * |
| | | | | | | | | |
+----+ +----+ +----+ +----+ +----+
+----+ +----+ +----+ +----+
| | | | | | | |
| | | | | | | |
+----+ +----+ +----+ +----+
This is really frustrating! I have started again in a new app get the same thing, always the lowest aligned row that doesn't show. If I switch to 3.5" view the problem is still there. I've tried spacing the buttons out further, played around changing all the text parameters, changed the view to disable autoresize subviews and changed mode from scale to fit but this is still happening. I can't find any other posts describing this issue, which seems odd as it's easily re-creatable. Please help.
Upvotes: 3
Views: 1526
Reputation: 11
You need to un click the "Use Autolayout" toggle under "Interface Builder Document. I had this same problem, and after disabling it the text displays correctly in the buttons.
Show utilities / File inspector / Interface builder / Use Autolayout
As far as I know, this is a new "feature" of iOS 6.1
Upvotes: 1
Reputation: 2704
I recommend to use the new autolayout-option of iOS 6 only in very special cases. I have tested this option very intensively and find out a lot of bugs, e.g.:
Using autolayout is currently very frustrating. Instead of using autolayout I use
- (void)viewDidLayoutSubviews {}
to adjust my UI programmatically, which is much easier and faster (at developing and at runtime).
Upvotes: 5