Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6: can't connect any IBOutlet to ViewController

Tags:

After upgrading to Xcode 6, I opened an old project (that contains a subproject, so it has many targets) and I noticed that no link from my Storyboard ViewContoller to the relative Objects works.

For example I have a ViewController with a TableView inside and now I cant do can't do anyhing with it because the connection is missing, I can't even redefine a new IBOutlet in the VC because the arrow in the storyboard from the VC won't connect to anything.

To be more clear:

screenshot

The class is defined in the Custom Class section, so I can't find the problem

screenshot

What should I do? Btw I'm using obj-c not swift, I found some related answer but all about swift.

like image 559
lorenzop Avatar asked Oct 05 '14 15:10

lorenzop


People also ask

What is @IBOutlet and ibaction in Swift?

IBOutlet & IBAction. Swift use @IBOutlet to specify a class property as an outlet variable, then you can use this class property to modify storyboard UI component’s attribute. Below example define a UILabel type variable, @IBOutlet means this variable is an outlet variable which can modify related label in the storyboard ui.

How to add IBOutlet property in Visual Studio Code?

3.1 Add IBOutlet Property Steps. Click to select the UI component such as a button or label. Then press Control key and click the mouse button to drag the source UI component ( label or button ) from left storyboard to right assistant editor window at the same time.

How to connect storyboard UI components to viewcontroller?

First you should add connections between storyboard UI components and ViewController class source code. The connection has a lot of types such as outlet (a class property variable that is used to refer to UI component), action (a class method that is used to response action event which UI component triggered.)

How to use @ibaction method in viewcontroller?

@IBAction is used to decorate a ViewController class’s method as an action method. It can has two method parameters, one refer to the event source UI component ( which UI component trigger this event ), the other refer to the event object ( what event happened ). 3. How To Create IBOutlet Property & IBAction Method In ViewController Source Code.


2 Answers

You can also see that the link between the parent view and the custom class is broken (not visible anymore) which is a huge problem.

I had the exact same issue with the app i'm working on actually, updating XCode from 5.xxx to 6.1. The workaround that worked for me was to remove the reference of every view controller and re-add them to the project...

To everyone facing that issue, here's the (annoying) trick :

  • Step 1 : select both .h and .m view controller files
  • Step 2 : remove the reference of those files
  • Step 3 : re-add the files to your project tree
  • Step 4 : open the storyboard, eventually re-build the project and smile

I can understand those things could be reaaally annoying, but it worked for me... Hope it will help someone else !

like image 102
Jerome Avatar answered Jan 03 '23 03:01

Jerome


In your storyboard hierarchy select the View Controller,

enter image description here

In the right pane Custom Class section Class, select the drop down and your desired view controller.

enter image description here

like image 36
Tom Howard Avatar answered Jan 03 '23 04:01

Tom Howard