正版滚动

2019-04-30  本文已影响0人  0bf43b438419

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.view addSubview:sc];
    for (int i = 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 =[NSArray arrayWithObjects:@"1",@"2",@"3", nil];
        img.image =[UIImage imageNamed:arr[i]];
        [sc addSubview:img];
         
}

上一篇下一篇

猜你喜欢

热点阅读