Ayrad
Ayrad

Reputation: 4056

Can't set custom class name

I can't seem to be able to set the identity of my view to GraphViewController in Xcode 4.2.

I dragged a regular UIView in storyboard on a UIScrollView.

I create a new file called GraphViewController extending UIViewController (.h and .m) but when I click on my view in storyboard and try to set the custom class name (its identity) to GraphViewController, it doesn't set it. It doesn't even show it in the dropdown list.

Am I missing something here a connection or something?

Upvotes: 2

Views: 2985

Answers (3)

Tim Isenman
Tim Isenman

Reputation: 190

My solution was making sure I was clicking on the controller's top tool bar, and not the "screen" UI frame. If you select the frame or anything in it, your Identity Inspector will be looking at the View, or other elements in the storyboard, instead of the controller itself.

Upvotes: 0

spfursich
spfursich

Reputation: 5405

In case anyone ever makes the dumb mistake I just did... ensure you have created an appropriate storyboard for either iOS or OS X. Adding the wrong one to your project will certainly cause issues like this.

Upvotes: 0

Gabriel
Gabriel

Reputation: 3359

You can set any class inherited from UIView to a UIView instance.
But you have created a UIViewController subclass, not a UIView subclass.

You can assign your custom class to the controller, not to the view.

Upvotes: 3

Related Questions