TTCombineDelegateProxy 0.0.1

TTCombineDelegateProxy 0.0.1

weizhenning 维护。



  • 作者
  • rollingstoneW

TTCombineDelegateProxy

使用运行时将代理方法分发到多个代理。

示例

在 TTCycleBanner.m 中

- (void)setDelegate:(id<TTCycleBannerDelegate>)delegate {
    TTCombineDelegateProxy *proxy;
    if (delegate && delegate != (id<TTCycleBannerDelegate>)self) {
        proxy = [TTCombineDelegateProxy proxyWithPriorDelegate:self secondaryDelegate:delegate];
    } else {
        proxy = [TTCombineDelegateProxy proxyWithPriorDelegate:self secondaryDelegate:nil];
    }
    proxy.whitelistForPriorDelegateSelector = @[NSStringFromSelector(@selector(pagingCollectionView:didSelectCellAtIndex:)),
                                                NSStringFromSelector(@selector(pagingCollectionView:didScrollToIndex:))];
    self.delegateProxy = proxy;
    [super setDelegate:(id<TTCycleBannerDelegate>)proxy];
}