我有一个UIScrollView
类的子类,这个卷轴有垂直内容。但我需要在父视图中将此UIScrollView
拖放到水平方向。我该如何实现呢?
答案 0 :(得分:0)
您必须具有特定的层次结构:
在您做任何事情之前,您必须转到StoryBored并取消选择FileInspector下的Autolayout选项。
但是,您必须在头文件中声明scrollView:
IBOutlet UIScrollView *yourScrollViewName;
在你的主要观察视频下载:
-(void)viewDidLoad {
yourScrollViewName.translatesAutoresizingMaskIntoConstraints = NO;
[yourScrollViewName setScrollEnabled:YES];
[yourScrollViewName setContentSize:CGSizeMake(320 ,554)]; //320 is the x which is the width. change this to make it horizontal.
//554 is the Height this has to be larger that the screen size in order to have vertical scrolling.
[yourScrollViewName setPagingEnabled:NO];
}