美文网首页
滚动视图

滚动视图

作者: 0bf43b438419 | 来源:发表于2019-04-26 16:56 被阅读0次

   UIScrollView *sc =[[UIScrollView alloc] initWithFrame:CGRectMake(0, 67, self.view.frame.size.width, 200)];

    sc.showsVerticalScrollIndicator= NO;

    self.view.backgroundColor = [UIColor whiteColor];

    sc.showsHorizontalScrollIndicator = NO;

    sc.contentSize = CGSizeMake(self.view.frame.size.width *3 , 0);

    sc.pagingEnabled = YES;

    sc.userInteractionEnabled = YES;

    [self.viewaddSubview:sc];

    for(inti =0; i<3; i++) {

        UIImageView *img =[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i,0 , self.view.frame.size.width , 200)];

        NSArray*arr =[NSArrayarrayWithObjects:@"1",@"2",@"3",nil];

        img.image=[UIImageimageNamed:arr[i]];

        [scaddSubview:img];

}

相关文章

网友评论

      本文标题:滚动视图

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