本文介绍了uiscrollview不能水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面我的UIScrollView不是横向滚动,请在这里帮助我..
My UIScrollView below is not scrolling horizontally, Please help me here..
FirstView = [[UIView alloc] initWithFrame:CGRectMake(60, 0, 100, 150)];
[FirstView setBackgroundColor:[UIColor clearColor]];
SecondView = [[UIView alloc] initWithFrame:CGRectMake(320+60, 0, 100, 150)];
[SecondView setBackgroundColor:[UIColor clearColor]];
HolderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1000, 150)];
scrHorizontalScroll = [[UIScrollView alloc]initWithFrame:HolderView.frame];
[scrHorizontalScroll setBackgroundColor:[UIColor redColor]];
[scrHorizontalScroll setContentSize:CGSizeMake(999, 150)];
[scrHorizontalScroll setScrollEnabled:YES];
[HolderView addSubview:scrHorizontalScroll];
[scrHorizontalScroll addSubView:FirstView]; [scrHorizontalScroll addSubView:SecondView]; [HolderView addSubView: scrHorizontalScroll];
HolderView不会横向滚动,但会发生这种情况,请帮助
The HolderView is not scrolling horizontally but which happen, please help
注意:我有一个mainView,它根据帧坐标在其顶部添加此HolderView。
Note: I have a mainView which adds this HolderView in its top section as per the frame coordinates.
[mainView addSubView:label].... [mainView addSubView:HolderView];
这是完整的结构
推荐答案
滚动视图仅在其内容大小大于时滚动。
A scroll view will only scroll when its content size is bigger than its frame.
这篇关于uiscrollview不能水平滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!