美文网首页
在主控制器里添加ScrollView,再添加入子控制器

在主控制器里添加ScrollView,再添加入子控制器

作者: 童宁_深圳_iOS | 来源:发表于2017-09-12 11:33 被阅读0次

    //初始化scrollview

    _vcScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0 ,0,  CYXwidth,CYXheight - 64 - 50)];

    _vcScrollView.backgroundColor = [UIColor whiteColor];

    _vcScrollView.pagingEnabled = YES;

    _vcScrollView.bounces = YES;

    _vcScrollView.showsHorizontalScrollIndicator = NO;

    _vcScrollView.delegate = self;

    [self.view addSubview:_vcScrollView];

    _vcScrollView.contentSize = CGSizeMake(CYXwidth*5, 0);

    ZMLatestViewController *firstV = [[ZMLatestViewController alloc]init];

    [self addChildViewController:firstV];

    //添加子控制器

    ZMNewVersionViewController *twoV = [[ZMNewVersionViewController alloc]init];

    [self addChildViewController:twoV];

    ZMHeroCircleViewController *threeV = [[ZMHeroCircleViewController alloc]init];

    [self addChildViewController:threeV];

    ZMVideoViewController *fourV = [[ZMVideoViewController alloc]init];

    [self addChildViewController:fourV];

    ZMColumnViewController *fifthV = [[ZMColumnViewController alloc]init];

    [self addChildViewController:fifthV];

    [self scrollViewDidScroll:self.vcScrollView];

    相关文章

      网友评论

          本文标题:在主控制器里添加ScrollView,再添加入子控制器

          本文链接:https://www.haomeiwen.com/subject/skhcsxtx.html