Technically, this does not matter: the declared type of UIButton* does not guarantee that calls with objects of other types are impossible. The fitst style allows you to access the UIButton properties using the "point syntax", and the second style allows you to reuse the handler for other user interface objects without causing your readers to wonder what is happening.
For example, if you know that the event handler is used only with buttons, you can declare the sender type as UIButton , and then do this:
- (IBAction)operationPressed:(UIButton *)sender { sender.adjustsImageWhenHighlighted = YES; }
In the second declaration, you need to write the following:
- (IBAction)operationPressed:(id)sender { [sender setAdjustsImageWhenHighlighted:YES]; }
On the other hand, if you plan to reuse a handler for different user interface objects, the second approach is preferable.
source share