custom viewcontroller from storyboard cannot be found in project structure - ios

I created a new ViewController on main.storyboard, labels, buttons added manually, but I did not see this viewController in the project structure to customize it programatically and move it to the view folder.
Is it a bug, or I missed something? Thanks!

You should create a new file for every viewcontroller you add to the storyboard.

Related

I have One storyboard with different/multiple UIViews and I want a ViewController for each UIView. Swift

I have one storyboard with different views, I do not want all the codes in ViewController.swift I would rather have a Swift for each UIView.
Is it possible? and how do I do?
Use UIContainerView instead of just UIView. When you drag a UIContainerView into your storyboard it'll automatically create a View. Just make a new Cocoa Touch Class file in your project. Make sure the file is put under UIViewController
Then click on the new View that was automatically generated, go to Properties, then select your new Swift file. This connects the View to the file.

Can you define a Segue in the storyboard to self?

I have an app that represents a folder structure. I have a UITableViewController for the folders and files listing, and a UIViewController for the Documents.
I want to be able to recursively navigate through the folder structure, so I want to reuse the Folder UITableView multiple times while I let the user drill down a folder structure.
Is there a way to draw a segue from the UITableViewController to self so when I select a folder I present another instance of the view, but with the content of the subfolder?
I did this in previous versions of Xcode, but I cannot figure this out on Xcode 9.
You can use Storyboard Reference and Storyboard ID of ViewController in Interface Builder
Screenshot
Yes you can do it. Add a hidden button in view controller and drag & drop segue self view controller.
I've never created a segue link to the same view controller, but based on Halil's answer above, it sounds like it's possible.
Rather than messing with hidden buttons, though, why don't you give your scene a storyboard identifier, and then instantiate and push/present your view controller through code? You could put your logic in the table view's tableView(_:didSelectRowAt:) method.

how to work with multiple viewcontroll and use the viewcontroll.h and m file

I am new with xcode.
I used one viewcontroller and coded it in the viewcontriller.h and .m files.
My problem is when I add more viewcontrollers, I can't create more action from the new viewcontrollers to the basic files (viewcontroller.h and .m).
For example to right click and drag swipe recognizer from new viewcontrollers to the viewcontroller files (h&m files) in interface builder.
As my comment seems to be the answer, I'll add it as an answer:
I suspect you do want to set the class of the newly added view controllers in interface builder to the class of the view controller you want it to be.
Then, you can drag-connect like with the first one, xcode did set up for you initially.
Also, do remember to use different view controllers for different purposes (you might have to create another subclass of UIViewController).

Why Main.storyboard doesn't show?

I'm new to ios develop,I learned about storyboard recently and I'm trying to use it.But at last the storyboard file looks doesn't be loaded.
What I have done is:
1.add some ui elements like Button to initial xib file of storyboard
2.modify Main Interface in project - General page to Main.(my storyboard file name is Main.storyboard)
When I start the app,the screen is all white with nothing.Anyone can tell me why this happened and how can I solve this bug.Thanks!
Update1:As this image shows,I have set initial xib for storyboard.
Since you said you didn't created the project with a storyboard template, look for this line in your info.plist
This could happen because the subview frames are being created outside the view frame. Try setting some alignment constraints in your subviews.
You have to set your controller as initial view controller.
You can find it in your Main.Storyboard on the right site, if you select your first controller.
Here in 2021, a default Xcode project uses scenes, but that requires iOS 13 and I wanted to support iOS 12. I deleted the SceneDelegate file from my project and the scene delegate functions from the AppDelegate file, but then my storyboard wasn't loading either. The problem is that I also needed to remove the Application Scene Manifest section from info.plist.

storyboard linking buttons to .h

Hi i'm just a bit confused on the linking things from the storyboard to the ViewController.h. I've created a new single view application project and when I went to the storyboard I made a button. Now I went to the editor view and ctrl-draged the button onto my ViewController.h which worked. But when i created another view controller on the storyboard with a button on it, ctrl-drag does not work anymore. I've tried typing in myself, -(IBAction)test:(id)sender;, but it wouldn't let me connect to the button on my second view controller.
You did not set your class name in the VC settings.

Resources