永远不会读取在初始化期间存储为“触摸”的值

时间:2010-12-16 06:08:38

标签: iphone iphone-sdk-3.0

我是iPhone开发的新手,我有一个以下的澄清

- ( 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

我不是什么意思......

请指导我......

1 个答案:

答案 0 :(得分: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];     
}