响应链(六)

2018-12-21  本文已影响14人  frankisbaby

API中的响应链:

UIView:

@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;  // default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue.

userInteractionEnabled默认是YES,如果设置为NO,用户事件会被忽略,从事件队列中移除;

UIControl:

- (void)addTarget:(nullableid)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;

target

The target object—that is, the object whose action method is called. If you specify nil, UIKit searches the responder chain for an object that responds to the specified action message and delivers the message to that object.

包含action对象的target对象。target对的action方法会被调用。 如果你指定了target为nil,UIKit会搜寻响应链中一个响应指定action信息的对象,传递这个消息给这个对象。

上一篇 下一篇

猜你喜欢

热点阅读