我的 UIScrollView 是一个大约 4500 像素的水平视图,用户需要水平滚动才能查看内容.
我设置如下:
- (void)viewDidLoad{[超级视图DidLoad];sview.frame = CGRectMake(0, 0, 568, 320);sview.contentSize = CGSizeMake(4500, 320);[sview setScrollEnabled:YES];}然而滚动视图什么也没做.有什么明显的我错过了吗?我已经尝试过网络上的每个教程.
我遇到了类似的问题.我做了以下修改,scrollView 开始为我滚动:
<块引用>
-(void) viewDidAppear:(BOOL)animated{[超级 viewDidAppear:动画];sview.frame = CGRectMake(0, 0, 568, 320);sview.contentSize = CGSizeMake(4500, 320);[sview setScrollEnabled:YES];}我认为这应该对你有所帮助.
My UIScrollView is a ~4500px horizontal view that the user needs to scroll horizontally through to view the content.
I have set it up as follows:
- (void)viewDidLoad
{
[super viewDidLoad];
sview.frame = CGRectMake(0, 0, 568, 320);
sview.contentSize = CGSizeMake(4500, 320);
[sview setScrollEnabled:YES];
}
Yet the scroll view does nothing. Is there something obvious I missed? i've tried literally every tutorial on the web.
I got similar issue. I did following modifications and the scrollView started scrolling for me:
-(void) viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; sview.frame = CGRectMake(0, 0, 568, 320); sview.contentSize = CGSizeMake(4500, 320); [sview setScrollEnabled:YES]; }
I think this should help you.
这篇关于UIScrollView 不会滚动,即使在内容大小设置后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 swift 3.0 中设置滚动视图内容大小how to set scrollview content size in swift 3.0(如何在 swift 3.0 中设置滚动视图内容大小)
阻止 UITableView 自动滚动Stop a UITableView from automatically scrolling(阻止 UITableView 自动滚动)
iOS UIScrollView 延迟加载iOS UIScrollView Lazy Loading(iOS UIScrollView 延迟加载)
在 iOS 5 模拟器上运行时,使用 iOS 6.0 SDK 并为 iusing iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模拟器上运
以编程方式创建部分屏幕 UIPageViewControllerCreate partial-screen UIPageViewController programmatically(以编程方式创建部分屏幕 UIPageViewController)
如何使用或不使用 ScrollView 使 ImageView 可缩放?how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可缩放?)