当我导入自定义类时,它可以在没有警告或错误的情况下进行编译。但是......你知道,它只是不起作用。知道吗?
#import "./myclass/MyClass.h"
static MyClass* myClass=[%c(MyClass) withState:0];
[myClass getDataFromServer];
乐趣
- (id)initWithState:(NSUInteger)state
{
if ((self = [super init])) {
_stateNow=state;
_stateToSet=state;
}
return self;
}
+ (id)withState:(NSUInteger)state
{
return [[[self alloc] initWithState:state] autorelease];
}
- (void)getDataFromServer{
UIAlertView* av = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"", nil)
message:@"Connection fail"
delegate:self
cancelButtonTitle:@"ok"
otherButtonTitles:nil,
nil] ;
av.frame = CGRectMake( 0, 0, 330, 480 );
av.tag=kScreenTag;
[av show];
}