Question

I have watched some tutorials on making iPhone apps and I am trying to add outlets to the "Object" selection in the Interface Builder menu. However I notice in the tutorials that when the inspector is opened on the object and the far right tab is selected, there are two extra dialogs in addition to the Class Identity selection and Interface Builder Identity where outlets may be added. I can't find those. When I created my project, I selected a Window-Based iPhone project. Does anyone know why I can't access that outlet tool?

Was it helpful?

Solution

It looks like you are using an older version of xCode. I recommend you upgrade to the latest version 4.6.

On the older version, you need to pick the template "View-based application" and not "Window-Based application.

Hope this helps.

OTHER TIPS

I don't know what the tutorial is trying to show, but the correct approach is to define a subclass in code, add the outlet to that subclass, drag an NSObject into your NIB, and set its class in the Identity inspector to your subclass. Because, otherwise, how is connecting the outlet really going to work when the NIB is loaded? The NIB-loading machinery will actually instantiate an NSObject, which doesn't have such an outlet, and then try to connect it, which will fail.

If you really want to persuade Interface Builder that NSObject has an outlet that it really doesn't, I think you need to use the Library panel. Select the Classes tab at the top and then select NSObject. You can also get there by clicking the right-pointing arrow next to the class name in the Identity inspector.

Then, in the bottom half of the panel, you can select Outlets from a pop-up and click '+' to add one. Note, that this is telling Interface Builder that all NSObjects within that NIB have that outlet. It's a per-class thing, not a per-object thing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top