Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a new storyboard in Xcode and making it the main one (black screen in simulator)

Tags:

xcode

ios

I accidentally deleted my original Main.storyboard file that came with the project when I first began it. Now, I need all of the steps necessary to create a new storyboard and make it the new main storyboard for the project. I only need one storyboard. When I run my app in simulator my whole app is just a black screen. Any help would be greatly appreciated. I am programming in Swift.

like image 497
evanhaus Avatar asked Jul 10 '16 09:07

evanhaus


People also ask

How do I make a main storyboard in Xcode?

From the File menu, choose New→New File... In the New File dialog, make sure you have selected the Resource subcategory of the iOS category on the left. Then choose the Storyboard item on the right and press Next (see Figure 4-24). In this screen, pick the Device Family for which you want to create your storyboard.

How do I add a storyboard to an existing Xcode project?

Those exact steps (I am using XCode 4.5 and iOS 6.0 ): Add new storyboard to the project by File->New->File... ->Userinterface->storyboard. Go to project summary and select MainStoryboard and select the storyboard name you just created.

How do you create multiple storyboards?

On the main storyboard, drag and drop a Storyboard Reference from the object library into the storyboard, then Ctrl + click a button on the main controller -> drag it to the Storyboard Reference -> Select Show. Now we just created a segue between two storyboards.


2 Answers

You need to make the following things to get it to work:

1. Create a new file

Add file


2. Select, name and save the Storyboard file

Storyboard


3. Select the file in the Deployment Info

deployment info


4. Drag a view controller into the file and select it as initial view controller (look at the inspector on the right)

view controller

like image 103
Devapploper Avatar answered Sep 21 '22 16:09

Devapploper


Let Me come up with a better solution

Method 1

if you have deleted the story board as remove refrence like this

enter image description here

don't worry about anything your storyboard is still safe.

inside your project suppose you have your project saved on desktop as project1 go to project1 then you'll see a couple of folders find a folder named project1

Open it and you'll see some file's like this

enter image description here

all you have to do is go to Base.ipoj folder and if you find these files

enter image description here

either you can drag the file to your project or you can add them by this way.

enter image description here

browse your file For example desktop/project1/project1/Base.Iproj/Main.Storyboard

enter image description here

click on Add button and you'll have your Storyboard file.

and if you deleted the file by selecting "Move to trash" You can look up into trash copy your file to another folder and add the file as mentioned in the above steps.

Method 2

if you want to add a new Storyboard just do :-

enter image description here

enter image description here

click on Next and save it and You'll have your new Storyboard.

like image 20
tryKuldeepTanwar Avatar answered Sep 22 '22 16:09

tryKuldeepTanwar