IOS学习(1)-UIButton

1. Why there use (id)sender in the button click event?

(id)sender is the object which sent the message to that selector. It's like in the delegate functions where you have the control passed in to the function, etc.
You'd use this if you had 2 objects which were calling that selector and you wanted to distinguish between them. Of course, you could just use two different functions, but it's often cleaner and less duplication of code to use one function.

2. 取消点击效果

button.adjustsImageWhenHighlighted = NO;

你可能感兴趣的:(IOS学习(1)-UIButton)