2011-09-12 79 views
0

林:touchesAnyObject不工作,因爲我認爲它使用下面的代碼可能

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    UITouch *touch = [touches anyObject]; 
    self.location = [touch locationInView:self.view];  
    NSLog(@"%@", NSStringFromCGPoint(location)); 
} 

爲了嘗試並找到用戶可能觸摸屏幕,並且我認爲[touches anyobject]將允許它來檢測其中即使選擇了另一個對象,用戶也已經觸摸了屏幕。但是,當我選擇一個按鈕,似乎並非如此。任何人都可以幫我嗎?

謝謝!

回答

相關問題