2010-12-16 19 views
0

我是新iPhone商發展和我有一個follwing澄清價值的初始化過程中存儲到「觸摸」是從來沒有讀過

- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event 
//----------------------------------------------------------------------- 
{ 
    if(!mouseSwiped) 
    { 
     UITouch *touch = [[event allTouches] anyObject]; 

     // Enumerates through all touch object 
     for (touch in touches) 
     { 
      // Sends to the dispatch method, which will make sure the appropriate subview is acted upon 
      [self dispatchTouchAtPoint:[touch locationInView:self.view] :touches :nil];  
     } 
    } 
} 

,當我運行靜態分析儀對我的申請,我得到以下

Value stored to 'touch' during its initialization is never read 

我沒有什麼意思......

請指引我出去......

回答

2

要做for each循環,必須在括號內聲明'touch',如下所示:

for (UITouch *touch in [touches allObjects]) { 
      // Sends to the dispatch method, which will make sure the appropriate subview is acted upon 
      [self dispatchTouchAtPoint:[touch locationInView:self.view] :touches :nil];  
} 
相關問題