Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode, can't find my class which I had created

Tags:

I'm playing arround with Xcode (for iOS) and added a View Controller to my Storyboard. Now I've created a Class (File -> New File -> Objective-c Class) and made that a subclass of UIViewController. Now the .h and .m files are generated and listed on the left side in Xcode, but when I want to change the "custom class" of my added View Controller there is nowhere my class which I had generated. Am I doing something wrong?

Thanks in advance.

like image 314
John Brunner Avatar asked Aug 25 '12 15:08

John Brunner


People also ask

Can not find in scope?

In general, it's safe to assume that the “Cannot find '…' in scope” refers to a variable, function, type or other symbol that doesn't exist. If you want to solve this error, and fix the bug, start with what doesn't exist and work your way from there (i.e., text).

How do I create a class file in Xcode?

To generate the class and properties files initially: From the Xcode menu bar, choose Editor > Create NSManagedObject Subclass. Select your data model, then the appropriate entity, and choose where to save the files. Xcode places both a class and a properties file into your project.

What are. m and. h files Xcode?

The . h is called the Header file and the . m is called the Implementation file. Together, they form the AppDelegate class.

What is the ViewController m?

ViewController. h/m define a view controller class that manages a hierarchy of views -- basically, one screen of an application. You might have multiple screens that each have their own view controller. AppDelegate. h/m define a class that manages the application overall.


2 Answers

I've had the same problem. Quitting and opening Xcode will make the Class show up in the list.

edit: I've also recently found pasting the Class name will work in 5.02 Xcode.

like image 104
mad pig Avatar answered Oct 07 '22 01:10

mad pig


I had the same problem. But I discovered that I was clicking inside the "window of storyboard" and was selecting a view, so with no viewController related to. My solution was: to click inside the owner, or the viewController from the left list, and then change the custom class.

like image 41
Eduardo Leal Avatar answered Oct 07 '22 01:10

Eduardo Leal