首页 > 代码库 > IOS UIScrollView背景色 及滑动范围设定
IOS UIScrollView背景色 及滑动范围设定
@interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; _scrollview1.backgroundColor = [UIColor greenColor];//设置背景色 绿色 _scrollview2.backgroundColor = [UIColor yellowColor];//设置背景色 黄色 _scrollview1.frame = CGRectMake(0, 0, 80, 1000);//<span style="font-family: Arial, Helvetica, sans-serif;">固定 scrollview1位置及大小</span> _scrollview2.frame = CGRectMake(80, 20, 240, 550);//<span style="font-family: Arial, Helvetica, sans-serif;">固定 scrollview2位置及大小</span><pre name="code" class="html">NSLog(@"%f,%f",_scrollview1.frame.origin.x, _scrollview1.frame.origin.y);//输出坐标 NSLog(@"%f,%f",_scrollview2.frame.origin.x, _scrollview2.frame.origin.y); // Do any additional setup after loading the view, typically from a nib.}//确定滑动范围 超出才会有滑动效果-(void) viewDidAppear:(BOOL)animated{ _scrollview1.contentSize = CGSizeMake(80, 900); _scrollview2.contentSize = CGSizeMake(240, 900); }
IOS UIScrollView背景色 及滑动范围设定
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。