首页 > 移动平台 > 详细

iOS--创建uiscrollview

时间:2017-01-09 18:58:29      阅读:250      评论:0      收藏:0      [点我收藏+]
//创建uiscrollview
    self.PageHeight = self.view.bounds.size.height;
    self.PageWidth = self.view.bounds.size.width;
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.PageWidth, self.PageHeight)];

self.scrollView.backgroundColor = [UIColor colorWithRed:61/255.0 green:61/255.0 blue:61/255.0 alpha:1];

[self.view addSubview:self.scrollView];
    self.scrollView.contentSize = CGSizeMake(self.PageWidth*self.FirstLayList.count,self.PageHeight);
    self.scrollView.contentOffset = CGPointMake(0, 0);
    self.scrollView.pagingEnabled = YES;
    
    //加载服务
    self.scrollView.delegate = self;


//完成拖拽
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    NSLog(@"完成拖拽");
    NSInteger juli = scrollView.contentSize.width-_PageWidth-1;
    if (scrollView.contentOffset.x >juli) {
        OldListViewController *oldlist = [self.storyboard instantiateViewControllerWithIdentifier:@"oldlist"];
        [self.navigationController pushViewController:oldlist animated:YES];
    }
}

 

iOS--创建uiscrollview

原文:http://www.cnblogs.com/qiyiyifan/p/6265906.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!