I have a XIB file inside of which there are some connections between some objects and the file's owner (a ViewController). I'm getting anything shown in the utilities sidebar that you can pop out from the sidebar in order to do some configuration stuff. It shows as "Not Applicable". I had created the XIB file along with the ViewController file (check marked the option in the New File sheet) so the file's owner was preconfigured to the ViewController by default. I have already made the connections and added the necessary IBAction selector for the UIControl stuff. Its just that whenever i select an object in the view frame, its config doesn't show up in the utilities. I have another XIB file hooked with some other view controller, and don't have the problem. What's up with Utilities sidebar????
I find restarting xCode often fixes this annoying bug.
Related
I am trying to implement a dropdown menu I found on github, it has pre-defined IBActions and IBOutlets. How do I connect theses outlets to the storyboard? Ctrl-drag is not working.
I believe my issue is that the file DropdownMenuController will not show up in the automatic section of files in the assistant editor. How would I add files?
Update:
The IBActions just aren't showing up anywhere. Here is an example:
All the outlets and actions that Xcode thinks exist
But here in the Objective-C files are IBActions that don't show up
First you have to set the right View Controller Sub class to the view controller in the interface builder. check the following setting
Now you open the Utilities panels and go to the connections inspectors, not the source files.
Select viewController in storyboard, open utility bar and in connection inspector you will find methods which are mark with IBActions
After drag and drop you will prompt like this
select vc first in storyboard like this
I have a project that has the header and the implementaiton files and loads a plain old UITableViewController from the .m but I have no way of configuring the View (I would like to do stuff like ad buttons and text fields onto the view instead of just having a table), should I create a .xib file so that I can modify the view? (Reason I don't just start a new project is that the current project has a bunch of other stuff like OAUTH processes that kick off at the AppDelegate stage to log a user into a system - and I need this functionality). So my question how can I create a .xib from the existing .m .h files and then add other objects which I can then code for.
An answer from this similar question:
"Here's a more step-by-step way to associate your new UIViewController and .xib.
Select File's Owner under Placeholders on the left pane of IB. In the Property Inspector(right pane of IB), select the third tab and edit "Class" under "Custom Class" to be the name of your new UIViewController subclass.
Then ctrl-click or right-click on File's Owner in the left pane and draw a line to your top level View in the Objects portion of the left pane. Select the 'view' outlet and you're done.
You should now be able to set up other outlets and actions. You're ready to instantiate your view controller in code and use initWithNibName and your nib name to load it."
If it's a UITableViewController, simply create a new XIB file via Xcode (File -> New -> iOS -> UserInterface -> View) and then add set the file's owner to your subclassed UITableViewController.
You'll likely want to re-do how the user interface looks -- in terms of dropping objects like the table view and buttons or whatever else -- into the XIB's view. It'll certainly save a lot of time versus trying to debug programmatically creating and adding subviews and actions.
And once that's in place, you can then make IBOutlets and IBActions to your heart's content.
I created a new singleView application without storyboard (say FirstProject) and another single view application with storyboard (say SecondProject)and then added a storyboard in the application which didn't have a storyboard previously.
Then I went in the FirstProject and changed the class of the storyboard to the viewcontroller class in identity inspector.
After that I opened other files in the two projects individually and made changes in the code to be same in the corresponding files in the two projects.
Now when I run the project which had storyboard at the time of creation shows a white blank screen but the other application (in which storyboard was added later) shows just a black screen with no errors and no warnings.. What is the difference in these two files?
What is it that I am missing. How to tell an application that it should now load its view from storyboard and not from a XIB file as there is none?
I second the "Good Job" building from scratch to truly Grok storyboards.
You need to delete the template code and just return YES; in application:didFinishLaunchingWithOptions:
Complete Process
Create a new project using the "Empty Application" template.
New File, User Interface, Storyboard
Set the storyboard in the targets summery (updates the info.plist)
Delete the template code and just return YES; in application:didFinishLaunchingWithOptions:
The way that a storyboard application knows to use the storyboard at launch time is that the Info.plist file contains an entry pointing to the main storyboard. You need to set that up. The "Main storyboard file base name" (UIMainStoryboardFile) must match the base name of the storyboard file; the system sees this and loads the designated storyboard file automatically as the app launches.
Also you need to make sure that the initial view controller in the storyboard is marked as the initial view controller.
I added a custom view controller class with interface (.h), implementation (.m) files, and UI (.xib) to an existing project.
When I ctrl-click and drag between the nib and the interface, it will not place an outlet or IBAction when I drag, so I can't link a UI element to a property. Also, XCode does not bring up the corresponding interface file when I view the nib in assistant editor mode.
Note: I changed the name of the custom class. I changed the filename and the references to it in the source.
Make sure you click on file's owner on the left and then in the identity inspector on the right, put in the custom class. You should then be able to make connections.
I followed this UITabBarController Tutorial which creates a Tab Bar with according subviews mostly using Interface Builder. The UITabBarController is created there and the Tab's View Controllers are added there too.
Am I correct that creating the UIViewControllers {WelcomeViewController|AboutViewController}.{h|m} is unnecessary?
Who is the real File's Owner of the Subviews {WelcomeViewController|AboutViewController}.xib?
Note that I at first tried to create an IBAction method in WelcomeViewController.h: in Interface Builder at WelcomeViewController.xib, I could connect a button press to that action as it appeared at File's Owner. But at runtime it crashed, as the real File's Owner presumably is not an Object of WelcomeViewController.m. Am I right here? Is it a bug that the IBAction appears in Interface Builder (Xcode 4 here)?
A last question: How/can I still separate code (having IBActions in WelcomeViewController.h for actions that happen only on this subview) when I connect everything up in Interface Builder like in the tutorial?
Am I correct that creating the UIViewControllers {WelcomeViewController|AboutViewController}.{h|m} is unnecessary?
No, both controllers are necessary, since there should be at least (and, optimally, at most) one ViewController per full-screen window to manage your view hierarchy. The TabBarController is only a kind of "dumb" meta-controller managing the display of the sub-controllers it loads - therefore you need controllers for the views which are switched. I would recommend you read this part of the Apple doc.
Who is the real File's Owner of the Subviews {WelcomeViewController|AboutViewController}.xib?
The File's Owner should be the corresponding controller class (in your case, {WelcomeViewController|AboutViewController}.{h|m}) - you can set the class in Interface Builder in the inspector palette when File's Owner is selected. Only the very first window (usually called Main.xib or so) which is opened at application start should have the application delegate as File's Owner. File's Owners own the objects of the XIB/NIB file - object-reference wise, you know what I mean :) I think it should also be possible to load the XIB/NIB file with other controllers (and the other controller automatically becoming the File's Owner), but I'm not sure.
... Am I right here? Is it a bug that the IBAction appears in Interface Builder (Xcode 4 here)?
It may be that you wired up the action the wrong way in Interface Builder, a common mistake. Try holding the Ctrl key, then drag a line from the button onto the File's Owner, and choose the desired method to link to. That should do it.
A last question: How/can I still separate code (having IBActions in WelcomeViewController.h for actions that happen only on this subview) when I connect everything up in Interface Builder like in the tutorial?
I think I answered this in the first paragraph - WelcomeViewController is still there and all you have to do is create IBOutlets and wire them up in IB. Of course, you can also do the wiring programmatically, since the member "view" is automatically populated (via the File's Owner connection), and all subviews are accessible from there.