Je fais un glisser un code dans lequel je suis en train de glisser, maintenant le problème est que quand je commence à le faire glisser lentement, ça marche cool, mais quand j'ai commencé à le faire glisser rapidement.Comment puis-je augmenter la vitesse de traînée du bouton?
Comment puis-je augmenter la vitesse de traînée?
- (void)wasDragged:(UIButton*)button withEvent:(UIEvent*)event{
CGPoint previousLocation;
CGPoint location;
UITouch *touch = [[event touchesForView:button] anyObject];
previousLocation = [touch previousLocationInView:button];
location = [touch locationInView:button];
CGFloat delta_x = location.x - previousLocation.x;
CGFloat delta_y = location.y - previousLocation.y;
button.center = CGPointMake(button.center.x + delta_x,button.center.y + delta_y);
}
Que signifie "bouton gauche pendant le glisser"? Comment faites-vous pour que 'wasDragging: withEvent:' soit appelé? –
a chuté pendant la traînée! J'ai fait un clavier personnalisé et sur ses boutons j'ai appelé un sélecteur qui appelle ce sélecteur. [a1 addTarget: action de soi: @selector (wasDragged: withEvent:) forControlEvents: UIControlEventTouchDragInside]; – Brad