Text views and image view disappearing from view controller in Xcode 6.1 storyboard
Asked Answered
A

6

37

I updated to Xcode 6.1 to fix an error I was having with the Interface Builder Cocoa Touch Tool spiking to 99% CPU usage when I used the storyboard, which would freeze Xcode. Now that that error is fixed, I have a possibly even more frustrating error.

When I use the storyboard, while I'm working on a UIViewController, my UITextView, my custom UITextViews (which are subclasses of UITextView, but for all intents and purposes in the storyboard, they're UITextViews), and my UIImageView suddenly disappear!

Here's how the default main view inside my view controller looks right now:

Main View

  • View
    • Activity indicator
  • Scroll view
    • Label
    • Text view (x=0, y=-65, width=0, height=0) ERROR!
    • Label
    • Custom text view (x=0, y=-65, width=0, height=0) ERROR!
    • Label
    • Custom text view (x=0, y=-65, width=0, height=0) ERROR!
    • Label
    • Custom text view (x=0, y=-65, width=0, height=0) ERROR!
    • Label
    • Label
    • Custom text view
    • View
      • View
        • Label
        • Button
      • Image view (x=0, y=0, width=0, height=0) ERROR!
    • ViewX
      • Label
      • Custom text view (x=0, y=-526, width=0, height=0) ERROR!
      • Width and height Constraints for this view.
    • Button
    • Width and height constraints for the scroll view
    • Center x and y constraints for ViewX within the scroll view.
  • Center x and y constraints for the scroll view within the main view.

It all started when I adjusted the size of the view controller using "freeform" in order to see views that were off the view controller screen. Once I used cmd-Z to change the view controller back to "fixed" (to the normal size), the missing elements appeared again and everything seemed fine. However, later on, I was editing the view controller and suddenly...bam! They're gone. And when I reset all of them to where they were supposed to be, it just happened again (resulting in the above described x, y, width, height values).

:-(

Does anyone know what could be wrong? I never had this error in Xcode 5.

EDIT:
I was able to use cmd-Z to get the view controller back to normal. Then I restarted my mac and reopened Xcode. Now, I've noticed that the error occurs whenever I resize anything in the storyboard by dragging with the cursor (it doesn't happen if I resize something using the width and height properties on the right panel in Xcode). It happens on other view controllers as well. Even in a view controller that has only a UILabel and a UIImageView in the default main view, when I click and drag the edge of the label to resize it, the image view disappears with values of x=0, y=-64, height=0, width=0.

CONCISE SUMMARY:
In the Xcode 6.1 storyboard, every time I resize any elements in a UIViewController, all UITextViews and UIImageViews collapse and get shoved -64 pixels above the upper left corner of the view controller.

UPDATE
It appears that Xcode 6.1.1 has fixed the bug.

Anadiplosis answered 21/10, 2014 at 3:5 Comment(12)
I'm pretty sure this is an Xcode 6.1 bug.Anadiplosis
Happening to me as well.Cygnet
same here, just ran into it.Grubby
I've talked with another developer, who appears to be having the exact same problem. I've tried several things, none of which have worked. I'm pretty sure this is an Xcode 6.1 bug.Anadiplosis
Count me in. (Xcode 6.1)Disenthrone
You can avoid this issue by resizing elements with Size Inspector.Disenthrone
Same problem here. Seems to happen when you put one item over another, even dragging it to another location. Very frustrating.Annoyance
happens to me as well. UIImageView disappeared from the storyboard and it won't show up in the running app. I noticed, that if I open a source code of the storyboard I see that the rect always resets to all zeroesUzzia
@Disenthrone the same would for a tableview right? My tableview has disappeared from the VC when i added a segue to it from the tabbar!Langmuir
Same here. It's annoying as hell. Hope they will roll out a fix soonCoexecutor
Have the same problem too! Hope it's going to be fixed fast!Prolate
See if this help. Set autoscroll for uitextview to false. #33498028Intermarry
M
23

Another workaround is to add constraints to the layout Before resizing of any views. (add missing constraints e.g.). The bug only seems to occur when there are no constraints available. I have reported the bug to Apple with Bugreporter.

Edit: So, at least it seems that Apple Bugreporter is working. The problem is fixed in XCode v 6.1.1.

Miltonmilty answered 24/10, 2014 at 6:18 Comment(8)
Thanks. I also reported the bug. And you are right, it only occurs when there are no constraints set up.Anadiplosis
I also reported the bug. I suggest others to the same. Very annoying & inconvenient bug.Idomeneus
Thanks it's working. I have a doubt that it was meant to be this way in order to force us rely on constraints while developing. 6.0 and 6.1 both have the issue and they would have noticed it as it's a major flow if they had perceive it as a problem in the first place.Gianina
the same would for a tableview right? My tableview has disappeared from the VC when i added a segue to it from the tabbar!Langmuir
I've also had problems with table views disappearing. If you set up constraints properly and the TV still disappears, you can always use the storyboard to update the table view to follow the constraints you've set. Very annoying, nonetheless.Anadiplosis
Okay, so some random "super" users just decided to reject my update for no sensible reason, so I hope people read this comment. My update to the question above would've been this: "Xcode 6.1.1 has fixed the issue." @Jonas, if you read this comment, please edit your answer with that update message so that it's more obvious to people reading this SO post that the bug has been fixed. Thanks!Anadiplosis
I have updatedd to Xcode 6.1.1 yet I am facing the same problem. Its not solved yet. Please help me.Forsberg
I just added one constraint and it stopped.Sustentation
P
8

Seems it's a bug in Xcode 6.1 !! The current solution is you should resize your elements from the Size Inspector.

Never do the resizing by mouse...

Pianette answered 23/10, 2014 at 7:13 Comment(2)
didn't help me. Put appropriate numbers in the Inspector - saw the UIImageView in the Inspector. Ran the app - no ImageView. Back to inspector - no ImageView. Repeat.Uzzia
I have updatedd to Xcode 6.1.1 yet I am facing the same problem. Its not solved yet. Please help me.Forsberg
C
1

If you uncheck "Use Autolayout" then it won't occur either. Though, you're back to using the old "springs and struts" method. Still, this can be set on a view controller by view controller basis so it's not too bad.

Coeducation answered 24/10, 2014 at 1:37 Comment(1)
You mean the 'good' old springs and struts :) Your mileage may vary.Stull
S
1

I was having the same problem. I just went to the Apple Developer website and downloaded the beta version of the new Xcode and they fixed this bug!

Spellman answered 1/12, 2014 at 13:34 Comment(1)
It's sad that it's "good news" that a company fixed something that they DEFINITELY should've never broke in the first place :/Anadiplosis
P
0

I just installed XCode 6.2 Beta and the issue seems to be fixed there.

Piccoloist answered 29/11, 2014 at 10:16 Comment(0)
S
-1

There are 2 types of 1 is main storyboard and 2 is launchscreen storyboard Your are placing all your views on launchscreen this appears when you app first time then it will not appear Place all your views on main storyboard instead of launchscreen

Seavir answered 23/9, 2017 at 7:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.