1

我正在使用一个已经由某人定义的自定义模板。当我使用该模板时,Xcode 不会要求"Class Prefix". 正因为如此,使用此模板创建的任何类都具有作为项目名称的类名,后跟我们提供的类名,如"SampleProjectViewController.h""SampleProjectViewController.m"

有没有办法在创建新类时添加"Class Prefix"字段并使用这个类前缀,这样当我创建一个新类时,预期的类名是SPViewController.hor SPViewController.m

4

1 回答 1

2

添加com.apple.dt.unit.prefixable到祖先,它会自动添加对话框。然后,___VARIABLE_classPrefix:identifier___用作替换字符串。例如。假设您有一个名为 Foo 的类:

@interface ___VARIABLE_classPrefix:identifier___Foo : NSObject
@end

@implementation ___VARIABLE_classPrefix:identifier___Foo
@end

文件不需要有那么长的前缀,你可以简单地在你的定义中通过使用像___VARIABLE_classPrefix:identifier___Foo.m键和Foo.m作为Path(或者你的命名工作)之类的东西来做到这一点。

于 2013-07-24T10:13:22.380 回答