iOS Storyboard ViewController went Blank - ios

I'm working on the code in a project when I suddenly notice the ViewController in Storyboards is greyed out with the name of the VC in the center.
Here's a screenshot..
I was only editing some code on the right and I'm not sure exactly when, but my eyes adjusted and noticed this VC completely greyed out in Storyboards.
I tried deleting Derived Data, cleaning, quitting Xcode, building again, etc.
Nothing seems to work... ANy help with this would be super appreciated. I'm also very new to programming in general.

Well it turns out if you ever run into this problem, it's because you're not paying close attention and haven't realized you've somehow magically deleted your entire view inside the ViewController.
I did this once before by hitting something randomly on my keyboard (don't know what it was) but that time I saw it happen and just hit "undo".
This time I was passed the point of simply hitting "undo" and had to add a view again and rebuild and reconnect all the components in the view. That was basically it. Problem solved...

Related

XCode 8 : Weird Storyboard issue that rolls back changes each time after it is saved

I am facing a really weird storyboard issue. I am using Version 8.0 (8A218a) . For one of my projects, I have two storyboard files, one for iPhone and one for iPad.
Both storyboards are behaving insanely: I open a storyboard file and make changes to a ViewController's view, then I save. I run the application and every thing is OK.
I switch to another file then open the stoyboard file again, and it loads back the old view! (changes subviews locations, to the left after I center them, the same subviews every time).
To track down the issue :
1- I made a copy of the project, cleaned, deleted derived data. Did not solve.
2- I thought about Source Control, so I disabled Git. Did not solve.
3- Unless it is a common bug, I am out of options.
The problem is that it does this in each of my 2 storyboard files. And when I open one and fix it them switch back to the second, I find it changed!
Did anyone face this weird issue with storyboard?
Any explanation and/or suggestion to solve it please?

Storyboard corruption on file open

I am having a problem where my content is repeatedly being shifted to the right in the storyboard for multiple view controllers when I open the project. I have done nothing at this point, simply opened it. Further, undoing the modifications through git does nothing. I fix the problems and go about my day adding new features... the apps run fine in the phone and appear normal in the storyboard. However, when I open the project the next day, same thing happens and I have to fix everything again. Has anyone else experienced this issue, and what was your resolution to the problem?
I figured out what the problem was. On my first View Controller, I had some labels that had somehow become set to a width of zero. After I fixed them, and embedded them in a stack, the problem resolved itself. I have no idea how this screwed up several other view controllers; however, fingers crossed, the corruption hasn't happened again since I fixed it.
Well apparently there is just some display bug in Xcode. When I click on a new size class and click back, the elements are restored to their correct size. This was maddening, but apparently it's working fine now if I do this quick fix.

Blank white screen every time I run the iOS simulator

I've created a simple program where a person can log in with a username and password. Every time I attempt to run it, I simply get a blank white screen. I tried changing the background color to a dark green one in hope that it would change it in the simulator too, however I get the same white screen.
This problem arose before I got that breakpoint error, it first started happening randomly in a previous project, which makes me think something is wrong with my xcode.
See my screenshot below:
I had this same issue where I saw the app briefly, and then it went to solid white. It pays to make sure you edit the "Main" storyboard, not the "LaunchScreen" storyboard when following tutorials...
Maybe my embarrassing mistake will help someone else...
There are a few things to keep in mind here that could be causing thsi error. Firstly, as some of the comments have pointed out the first thing you should do is delete the breakpoints from all the lines. To do that, you have 3 choices:
Press the blue arrow just above the console, that you can see here:This will disable all your breakpoints, so if you are using them intentionally somewhere else, don't use this method.
You can press each breakpoint individually, simply pressing the arrows next to your code on the left-hand side. This will disable the specific breakpoint. They then will become more greyish, like the one below #IBAction func loginTapped()
Last but not least, in my opinion the best method, simply grab the blue arrow and drag it to the right or left. This will make a cloud and zishing noise, symbolizing the deletion of the breakpoint.
Once this is out of the way, let's take the second most important step. Check that the loginViewController is the initial View Controller, so that it's the first page that's displayed. To do that, simply open the file inspector on the right-hand side. You can activate it by pressing the third button here:
Then, select your viewController,, so that it light up's blue like seen below:
Then, on the 3rd tab of The file inspector, by pressing the 4th tab that looks like an arrow pointing down. Now you should see a checkbox saying "isInitialViewController". Tick that so that you get through immediately to this screen. It should look like this down below:
Lastly, I'd like to point you to some more things you should check that could cause this error:
You never actually create the UITextField and UIButton
You have a different view covering your viewController(eg, webView or view)
You are on the wrong storyboard, this could happen but is unlikely.
If all this fails, try restarting Xcode, the simulator and running again by pressing the Play Sign or CMD-R.
Hope that helps, Julian
I don't know who this might help but I solved my problem by reinstalling CocoaPods and installing everything with pod install and pod update. I reset my mac some time back because it's storage was full and I forgot CocoaPods and all the pods uninstalled. Reinstalled them and now I'm back.
Edit:
It didn't fix it but I am getting closer.
It happened to me after exiting Xcode and closing the simulator the simulator device setting changed to the default ipod, when I realized this I changed it back to iPhone11. I got the white background but after waiting a few minutes it just worked.

Black screen when I add UINavigationController

I am following the Udacity tutorial on Swift, and for some reason when I added the second view, I usually get a black screen (as in the screen print) right when I open the app. Occasionally I get it working but usually not.
What could be the problem?
Noticed that "Did appear" is printed before "Will appear", is that a bug or did I do something wrong?
I have read this and this but it didn't help much. I also have tried several times to clean the project and rebuild it (nothing changed).
One time I just commented out some code (from the second view that should be loaded) and it worked suddenly. When I uncommented the same code it still worked.
Another time it worked when I disconnected the second view on the story board (it was still there, just no way to reach it).
Both have worked at least one time, and not worked many times.
Sorry this seems like I throw in random pieces of information, but I have no idea what could be the reason.

Done Button not working in FlipsideViewCOntroller

I'm updating my app form xib files to a storyboard. I'm also upgrading the app to iOS 7.
I have a two page app, like a Utility app. I can create e segue to flip to the second page. However when hitting the done button nothing happens. I've tried several things (the suggestions on SO too) but without result.
Ik started a new project (Utility) an compared the code for the segue and for dismissing the FlipsideViewController. In my project and the new one the code is the same.
I placed an NSLog call in the flipsideViewControllerDidFinish method but no effect.
I am out of ideas, please help.
While posting I got a (last) Idea. I had to check if the segue identifier was correct.
And it wasn't. So I corrected it and it works like a charm.
Thank you.

Resources