iOSマルチエージェント実現

1708 ワード

http://www.cocoachina.com/ios/20151208/14595.html
//実現原理
https://www.jianshu.com/p/961cfc9a446b
 
つの中間の橋渡しの管理種類を書いて、すべてのdelegateを管理します。
使用方法:
  SVHomeCycleDelegateObj *obj = [[SVHomeCycleDelegateObj alloc] init];
    self.obj = obj;
    @weakify(self);
//    
    self.multidelegate = [[NVMMultidelegate alloc] init]; //  delegate   
    
    SVHomeCycleScrollView *cycleScrollView = [SVHomeCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, WIDTH_WITH6(17)+self.safeTop, Main_Screen_Width, header.height - (WIDTH_WITH6(17)+self.safeTop)) delegate:self.multidelegate placeholderImage:nil];
    cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
    cycleScrollView.backgroundColor = [UIColor colorWithWhite:0.f alpha:0];
    cycleScrollView.infiniteLoop = YES;
    [header addSubview:cycleScrollView];
    self.cycleScrollView = cycleScrollView;
    
    [self.multidelegate addDelegate:obj];
    [self.multidelegate addDelegate:self];
 
転載先:https://www.cnblogs.com/tufei7/p/10826684.html