2012-06-15 23 views
0

當我導入自定義類時,它可以不經過警告或errs.But編譯,但是...你知道,它只是不工作。任何想法?這些,如何使用自定義類導入到tweak.xm

#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]; 
} 
+0

它不起作用?你能顯示整個頭文件和實現文件嗎?另外,'%c(MyClass)'語法是什麼?我從來沒有見過它 – newacct

回答

0

我得到它sloved。

static MyClass * myClass = [MyClass withState:0];

應該更改makefile。

相關問題