要做一个类似这样的类:
public class test
{
public static final String tableName = "asdfas";
public static final String id_Column = "_id";
public static final String Z_ENT_Column = "Z_ENT";
}
可以不用实例进行访问:
String abc = test.tableName;
要做一个类似这样的类:
public class test
{
public static final String tableName = "asdfas";
public static final String id_Column = "_id";
public static final String Z_ENT_Column = "Z_ENT";
}
可以不用实例进行访问:
String abc = test.tableName;
OC没有这样声明静态变量得风格,如果硬要这样得hua
test.h 中
@interface test : NSObject
+(NSString *) tableName;
@end
test.m
@implementation test
+(NSString *) tableName {
return "asdfas";
}
@end
使用得地方就可以
test.tableName
这种写法当然及其不推荐,太过繁琐;推荐OC风格得 #define更好