Cannot Create Outlet Connections to Subviews in Interface Builder (Xcode 5)

Cannot create outlet connections to subviews in Interface Builder (Xcode 5)

You can manually write the IBOutlet property declaration in the @interface of the custom view subclass, and assuming you've defined the base class of your subview in IB, then you can drag from the outlet circle in the code back to the control in the scene.

Sample Image

Or, as you point out, Warren Burton suggested both this technique and another in his answer to this other question, Can't Wire to Subview in IB.

can't create outlet from storyboard to editor from a subview

You can manually write the IBOutlet property declaration in the @interface of the custom view subclass, and assuming you've defined the base class of your subview in IB, then you can drag from the outlet circle in the code back to the control in the scene.

It was answered here: Cannot create outlet connections to subviews in Interface Builder (Xcode 5)

or you can try this:

After typing the property outlet declarations manually in the customview.h file I could ctrl-drag-connect them from there to their corresponding UIlabel objects in the interfacebuilder. Works only in this direction!

Interface Builder won't allow connections to custom UIView class?

Note that I did get this to work today, but had to insert/type the outlets by hand in the derived class, then I could drag from the header file to the UI element in the Storyboard, but not the other way around.

Unable to connect IBOutlet from storyboard to UIView subclass

After trying some of the given solution what finally worked is by restarting the my macbook. It seems like a bug on XCode's side. Oh well.

Can't Wire to Subview in IB

You are actually completely right. It wont let you connect from IB to the Header of a custom view in Xcode 4.6.2

Personally I would file a Radar but I would want to do a bit more research to prove it and as this is a pattern I wouldn't ever use then I won't.

Fortunately you can get around it

Make sure your custom view is configured correctly in IB

Sample Image

and assuming you are setup something like this

Sample Image

Then you can manually declare in your header

@interface MyCustomView : UIView

@property (weak) IBOutlet UILabel *label;

@end

And drag FROM the dot that appears beside the property TO the label.

Or drag FROM the right-click HUD of the custom view TO the label.

Neither case will work by dragging from the label to the view.

Connect label to an outlet in XCode 5

If you set the "Custom Class" of your table view cell in your storyboard or XIB file to "ArticleCell", you should be able to control drag your outlets to your labels again.

Connect outlet from file to storyboard in Xcode 7

Ok, solved. I'm able to connect outlet from connection inspector in Utilities panel.

Creating IBoutlet from UIView in custom UIView class swift

In your situation, you should connect the outlets to a view controller instead of a view.

Instead of creating a UIView subclass, you should create a UIViewController subclass:

class FrontViewController: UIViewController {

}

Next, select your view controller in the storyboard. In the Identity Inspector (select the tab with an ID card on the panel on the left), type "FrontViewController" (the name of your class) into the "Class" field.

Sample Image

Now you should be able to drag outlets to the class!

IBOutlet is nil, but it is connected in storyboard, Swift

The storyboard wasn't recognizing any further UI things I added to it. At run time all the references were nil. So I cleared my derived data folder and then those connections worked again.



Related Topics



Leave a reply



Submit