2010年10月30日 星期六

多點觸控試驗

今日做了 Multi-Touch 測試,原本拿 [touches Count] 來檢測觸控點的數目,可是在任何情況都是 1。於是我改用 [event allTouches] 後便成功了:
- (void)touches:(NSSet *)touches withEvent:(UIEvent *)event  {
NSSet *touchArray = [event allTouches];
NSMutableString *string = [[[NSMutableString alloc] init] autorelease];
[string appendFormat:@"Event count: %d\nTouch count: %d", [touchArray count], [touches count]];
[textView setText:string];
}