Isaacm
Isaacm

Reputation: 389

I can't create an outlet in Xcode 5

I am trying to link a create an IBOutlet for a UIWebView Element, however whenever I hold down control and drag from the Storyboard to the ViewController.h file, nothing happens and an outlet is not created. I already have an outlet in this file, however, I would like to create another one. Whenever I go to the view controller for the previous outlet and hold control and drag the element to the ViewController.h file a new outlet is created. Is there a setting that I have enabled that stops this shortcut from working. Is there another way to create an outlet for ios in Xcode 5.0.1 on Mac OSX 10?

Upvotes: 2

Views: 6462

Answers (2)

Isaacm
Isaacm

Reputation: 389

Fixed issue. The class of the view controller was UIViewController not ViewController. This meant that the ViewController.h and .m files were not showing up under Automatic. Once changed I could view the ViewController.h and .m files and create outlets in them.

Upvotes: 4

Jojodmo
Jojodmo

Reputation: 23616

I recommend not using storyboard, while it is a lot easier to use, it doesn't let you do many things. To create a new outlet, go to where you want to create it (this will most likely be a header file) and then type: IBOutlet yourOutletType *yourOutletName so to create a UIWebView you would type:

IBOutlet UIWebView *myWebView

and to create an outlet, such as a UIImageView, you could type

IBOutlet UIImageView *imageView

just remember to hook it up in your .storyboard file.

Again, I recommend not using storyboard, it IS a lot easier, yet it really has lots of limitations

Upvotes: 0

Related Questions