I have xcode 4.5 and I want to add two project's file in my project.
But the problem is - In that two class both class's name are same.
I changed the Class prefix from file inspector but it is changing the newly added file's name.
not my existing class name.
How to change all the existing class name or single class name ?
Select your class name in .h/.m file
Goto Edit->Refactor->Rename
Enter the new name for the class
Related
I don't even have this class named " _TtC14Metro_Explorer7Station" in my project...Anyone knows how to fix this problem?
Here are all my files in this project, and a class named station which I used to display the name of stations on the screen
target membership
I just started developing for iOS and WatchOS and have encountered a small issue that is probably very simple but I can't find any solution for it.
The issue I'm having is that I'm trying to structure my files in my own way but when creating new controllers, I cannot find them in the Custom Class dropdown on the Interface.storyboard
For example, I renamed InterfaceController.swift to Controllers/InitialViewController.swift to better match what I'm trying to do with my project structure.
For some reason InterfaceController still is showing up on there and if I type in the fullname of the new class, it won't show up. I'm unable to get that class here.
Any help at all would be great, thanks!
Renaming your file will not change the class name. You will have to modify the class declaration inside the file.
class InitialViewController: UIViewController {
/* code for your class */
}
Also, putting your files inside folders (blue folder icon) or Xcode groups (yellow folder icon) will not affect the class name.
When I create a new project in IoS, I get default ViewController class, called ViewController
I am using xcode7 and when I try changing the class name to ViewControllerSomething it tells me Xcode7 does not support that (yet).
My question, how do I modify the name of the class manually?
What I tried:
changed the file name
Changed the class name itself -> now I get a build warning
2016-01-28 13:17:41.877 TestPRJ[1400:491868] Unknown class
ViewControllerCategories in Interface Builder file.
Tried to modify any reference to ViewController in the Main.storyboard and in LaunchScreen.storyboard (opened as source code).
Now I get a build error:
/Users/itaymoav/Desktop/playworkspace/TestPRJ/TestPRJ/Base.lproj/LaunchScreen.storyboard:
The document "LaunchScreen.storyboard" could not be opened. Could not
verify document content.
After you manually rename the class:
Go to the storyboard which uses it (if it's a new project created from template it should be called Main.storyboard).
Make sure that scene is selected on the left panel (it should be called "View Controller Scene").
On the right panel go to the identity inspector (3rd icon) and under "Custom Class" select your new class name, it should be listed there.
Since Xcode 6.2 it wants to prefix a filename with its type.
So a "Test" UIViewController now is named:
UIViewController+Test.h,
UIViewController+Test.m
rather than Test.h, Test.m.
I have tried 6.3 and 6.4 beta and they all exhibit this habit. How do you stop it?
Many thanks.
You created a category, not a class.
When you use the “Objective-C File” template, you can create an empty file, a category, a protocol, or a class extension. You cannot create a class using the “Objective-C File” template. Here's what it looks like when you create a category:
To create a class, you need to use the “Cocoa Class” template. Here's what it looks like when you create a class:
It will automatically add the class name as a prefix for categories, if that's what you mean:
Select IOS -> Source -> CocoaTouch Class and the select UIViewController then write your class name Test by removing UIViewController which is alrady present in class name. If you write your class name first then select UIViewController then it will appear attached with your class name
I am using a custom template that was defined already by some one. When I use that template, Xcode is not asking for "Class Prefix". Because of this, what ever the classes that are created using this template are having a class name as project name followed by the class name we are giving like "SampleProjectViewController.h" or "SampleProjectViewController.m".
Is there a way to add "Class Prefix" field and use this class prefix, while creating new classes, so that when I create a new class, expected class name would be SPViewController.h or SPViewController.m ?
Add com.apple.dt.unit.prefixable to the Ancestors, it will automatically add the dialog. Then, use ___VARIABLE_classPrefix:identifier___ as a replacement string. Eg. let's say you have a class called Foo:
#interface ___VARIABLE_classPrefix:identifier___Foo : NSObject
#end
#implementation ___VARIABLE_classPrefix:identifier___Foo
#end
Files don't need to have that long prefix, you can simply do that in your Definitions by using something like ___VARIABLE_classPrefix:identifier___Foo.m as the key and Foo.m as the Path (or however your naming works).