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.
Related
How do I open the .swift file for ViewController below, on the left?
I'm ultimately following
question for how to access text in UITextField
but don't know how to open the ViewController to do it.
Just press the button at the right inspector.
In case you deleted or renamed that view controller, you should rename the class of the respective view controller in storyboard.
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.
I am following the tutorial here. I just created my first storyboard and tried to set it as the main storyboard. After following the tutorial I clicked the run button and the simulator doesn't render any of the changes ive created.
I have a screen shot of my xcode project here(not sure how else to display it): https://app.box.com/s/okw7jlzq5zmcetd5cehu
What am I doing wrong?
Here is another screenshot of the storyboard itself: https://app.box.com/s/jt6i0an3maowwvgsamk7
Place a checkmark in the box "Is Initial View Controller" for the view controller you want to load.
I think your problem is the code in the app delegate. When you use a storyboard, you don't need anything in there except "return YES". The storyboard creates the window, so the code you have in there is making another window, not the one that your storyboard controller is a subview of.
Using this tutorial might teach you some things about the structure of an iOS app, but if you just want to make an app with a storyboard, you should start with the "single view" template instead of the "empty" one. It will give you a storyboard and an initial controller.
So I'm going to try to explain my issue as best I can.
I have 2 View Controllers on a Storyboard. One is the "main" VC and the second is a "EULA" VC.
The main view controller has a UIWebView which loads the primary UI and works fine. This controller uses code to perform a Modal segue to the EULA VC which is created in the interface builder. This also works fine.
Now here lies my problem. The EULA view controller also has a UIWebView on it but I can't seem to connect this view controller to any connection by means of CTRL + drag. The "main" UIWebView is connected to ViewController.h
This is how I create my connection with CTRL + drag:
My question is why am I able to connect the first UIWebView on the Main view controller but not the other UIWebView on the EULA view controller? What am I missing?
Have you set up the EULAViewController.h as the custom class for the ViewController in Interface builder? Select the UIViewContoller in Interface Builder and in the third tab make sure the class is correct. Here is a screenshot explaining what I am saying:
Also make sure you have selected the correct file in the right pane, both red boxes should show the name of your custom UIViewController subclass:
I am think this is a bug in XCode or what. But this is very rare issue. I also got this issue sometime. So posting a solution which can make you little nervous to implement. But it works for me sometimes. You can try it . -
Just create a new UIViewController subclass in your project and name it something slightly different than the first. Then, copy/paste all code from old non-working UIViewController into the new UIViewController subclass (.h and .m) and change all relevant symbols according to the new UIViewController subclass name. After doing this I found everything worked as normal in terms of trying to control-drag wiring the buttons.
Happy coding. :)
Recreating the class files, renaming the view to something else then back to EULAViewController AND following these steps I was able to fix the issue.
Close the project you are working on with.
Delete the【DerivedData】folder of you project. (This folder may
inside your project's folder, or inside
~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere
else that were setup by you.
restart you project.
I'm trying to make an app for iOS but I'm new to Xcode, and I'm having some problems. In my project file I have a "ViewController.xib", but I need a tabbed application so I created a storyboard and I moved the ViewController from the ".xib" to the Storyboard. In the storyboard I have a Tab Controller with two items, one of them is the ViewController (a photogallery) moved from the ".xib". I've changed the class, I've changed the "Main Interface" with "Main Storyboard" in the project Info, but when I run my application I can't see the Storyboard but the single View Controller, alone. It's like the Storyboard doesn't exist. Forgive my ignorance, I hope you can help me.
While creating app checkmark the Storyboard