Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should add a handler for the 'drag enter' event for each button - I'm not sure that you can do this in interface builder but here's how to do it in code.</p> <p>Put this in your viewDidLoad method :</p> <pre><code>[button1 addTarget:self action:@selector(buttonEntered:) forControlEvents:UIControlEventTouchDragEnter]; [button2 addTarget:self action:@selector(buttonEntered:) forControlEvents:UIControlEventTouchDragEnter]; [button3 addTarget:self action:@selector(buttonEntered:) forControlEvents:UIControlEventTouchDragEnter]; [button4 addTarget:self action:@selector(buttonEntered:) forControlEvents:UIControlEventTouchDragEnter]; [button5 addTarget:self action:@selector(buttonEntered:) forControlEvents:UIControlEventTouchDragEnter]; </code></pre> <p>and then </p> <pre><code>- (void)buttonEntered:(UIButton *)button { NSLog(@"Dragged into %@", button); } </code></pre> <p>Have a <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html#//apple_ref/c/tdef/UIControlEvents" rel="nofollow">look at this</a> for the different types of control events you can listen for.</p> <p>NB This example assumes that you have got this in your .h file :</p> <pre><code>@property (nonatomic, retain) IBOutlet UIButton *button1; @property (nonatomic, retain) IBOutlet UIButton *button2; @property (nonatomic, retain) IBOutlet UIButton *button3; @property (nonatomic, retain) IBOutlet UIButton *button4; @property (nonatomic, retain) IBOutlet UIButton *button5; </code></pre> <p>and connected them correctly in interface builder etc.</p>
 

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