-
Notifications
You must be signed in to change notification settings - Fork 479
如何监听控制层上的按钮点击事件?
changsanjiang edited this page Nov 25, 2020
·
1 revision
这里以监听播放按钮的点击为例:
- 获取对应的item, 并注册通知:
- (void)test {
SJEdgeControlButtonItem *playItem = [_player.defaultEdgeControlLayer.bottomAdapter itemForTag:SJEdgeControlLayerBottomItem_Play];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(itemActionDidPerformWithNote:) name:SJEdgeControlButtonItemPerformedActionNotification object:playItem];
}
- 实现通知回调:
- (void)itemActionDidPerformWithNote:(NSNotification *)note {
#ifdef DEBUG
NSLog(@"%d - %s", (int)__LINE__, __func__);
#endif
}