James Linnell
James Linnell

Reputation: 3834

Custom Class, IBOutlets Not Working?

I have a custom class, derived from UIView, called Element. In Element I set up some IBOutlets to handle some UIImageViews I have in my XIB.

My ViewController adds the Element object to a larger view where the Element moves around. And I added an Object with class Element in IB, and connected the Outlets up through that. But in my Element class, I can't set any variables for an Outlet, nor can I get any variables, for it will output (null). Am I linking everything up wrong? It'd be really nice to get this to work right.

Edit: Basically it's like the Outlet linking doesn't actually link, so I'm trying to get/set blank objects.

Upvotes: 1

Views: 332

Answers (1)

John Franklin
John Franklin

Reputation: 4912

You may need to explicitly tell IB about your custom class. In IB, highlight your custom object and select the "Classes" in the Library pane. If you can't see an inheritance tree all the way back to NSObject, use "File -> Read Class Files..." to read in the header for your class.

Upvotes: 1

Related Questions