Tuesday, January 18, 2011

NSStringFromCGRect

Ha CGPoint-ot akarok logolni, akkor:
NSLog(@"%@", NSStringFromCGPoint(cgPoint));
Ha meg CGRect-et akkor:
NSLog(@"%@", NSStringFromCGRect(cgRect));

Monday, January 17, 2011

1 touch vagy tobb

Mashogy kellett lekezelni a sima touch-ot a UIView-n es mashogy a dupla touch-ot. Itt a megoldas (innen):
switch (tapCount) {
case 1:
[self performSelector:@selector(singleTapMethod) withObject:nil afterDelay:.4];
break;
case 2:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(singleTapMethod) object:nil];
[self performSelector:@selector(doubleTapMethod) withObject:nil afterDelay:.4];
break;
case 3:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(doubleTapMethod) object:nil];
[self performSelector:@selector(tripleTapMethod) withObject:nil afterDelay:.4];
break;
case 4:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(tripleTapMethod) object:nil];
[self quadrupleTap];
break;
default:
break;
}
Ami persze a touchesEnded:withEvent-be megy.