IOS学习(1)-UIButton

2016-06-28  本文已影响11人  deactivateuser

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;

上一篇 下一篇

猜你喜欢

热点阅读