Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you're adding target to control you can pass 3 types of selectors for action - </p> <pre><code>- (void)action - (void)action:(id)sender - (void)action:(id)sender withEvent:(UIEvent*)event </code></pre> <p>Names don't matter, it's number of parameter which is important. If control sends it's target a message with 2 params then first parameter will be control itself (instance of <code>UIButton</code> in your case), second one - instance of <code>UIEvent</code>. But you expects instance of <code>NSSet</code> as first parameter and send it a message <code>anyObject</code> which <code>UIButton</code> doesn't understand. This is the cause of crash.</p> <p>Why are you trying to send event from UI control to touch handling method <code>touchesMoved:withEvent:</code> in the first place? It will probably do something different from what you meant.</p> <p><strong>UPDATE:</strong></p> <pre><code>- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent *)event { UITouch *t = [touches anyObject]; CGPoint touchLocation = [t locationInView:self.view]; NSLog(@"%@", NSStringFromCGPoint(touchLocation)); } - (IBAction)buttongDragged:(id)button withEvent:(UIEvent*)event { NSSet *touches = [event touchesForView:button]; [self touchesMoved:touches withEvent:event]; } </code></pre> <p>Notice that since <code>touchesMoved:withEvent:</code> is a <code>UIResponder</code>'s method and controller's view <em>is</em> <code>UIResponder</code> this method will be also called on touch events for this view.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload