2010-09-08 58 views
0

好吧,這裏是交易,我不斷收到這樣的警告:AppDelegate的問題(警告:「AppDelegate中」可能不響應...)

「的AppDelegate」可不迴應「-setViewMovedUp:」

這是我實現文件:

- (IBAction)viewUp { 

    AppDelegate *moveUp = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    [moveUp setViewMovedUp:YES]; //move Shot View 
    [self setViewMovedUp:YES]; 

} 

,這是我的AppDelegate實現文件:

- (void)setViewMovedUp:(BOOL)movedUp { 

    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:0.5]; 

    CGRect rect = shotView.frame; 
    if (movedUp) 
    { 
     rect.size.height -= 200; 
    } 
    shotView.frame = rect ; 

    CGRect rect2 = pageControl.frame; 
    if (movedUp) 
    { 
     rect2.size.height -= 395; 
    } 
    pageControl.frame = rect2 ; 

    [UIView commitAnimations]; 


} 

我gessing,我得到一個警告,因爲AppDelegate的不是觀點,而是我真的方法調用視圖中,是有辦法,我可以編碼不同,更好地得到這個惱人的警告會消失嗎? (該方法仍然工作的方式......)

謝謝!

//AppDelegate.h 
... 
- (void)setViewMovedUp:(BOOL)movedUp; 

回答

1

您需要聲明的方法在接口(.h)文件中:如果你的應用程序委託頭文件中聲明的方法

+0

的伎倆,謝謝! – 2010-09-08 12:58:56

1

警告應該消失。把它放在你的AppDelegate.h中:

- (void)setViewMovedUp:(BOOL)movedUp; 

這應該這樣做。