在iOS6,XCode 4.5中,尽管设置了contentSize,但UIScrollView不是滚动 [英] In iOS6, XCode 4.5, UIScrollView is not Scrolling, despite contentSize being set

查看:109
本文介绍了在iOS6,XCode 4.5中,尽管设置了contentSize,但UIScrollView不是滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最后一小时试图让我的scrollView滚动,我一直在撞墙,但无济于事。在 viewDidLoad 我有

I've been banging my head against the wall for the last hour trying to get my scrollView to scroll, but to no avail. In viewDidLoad I have

  NSURL *url = [FlickrFetcher urlForPhoto:self.photoData format:FlickrPhotoFormatLarge];
  NSData *imageRawData = [NSData dataWithContentsOfURL:url];
  UIImage *image = [UIImage imageWithData:imageRawData];

  self.scrollView.delegate = self;
  self.imageView.image = image;
  self.scrollView.contentSize = image.size;
  self.imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height);

我将imageView视图模式设置为左上角。

I have the imageView view mode set to top left.

我的UIScrollView是通过选择我的imageView,然后是编辑器 - >嵌入 - > ScrollView创建的。

My UIScrollView was created by selecting my imageView, then Editor -> Embed in -> ScrollView.

还有其他我可以检查/试试吗?

Anything else I can check/try?

推荐答案

如果你已经通过笔尖创建了你的滚动视图,如果那个笔尖有自动布局功能,那么它就不会让你滚动。

If you have created your scrollview through nib, and if that nib has autolayout feature then it will not let you scroll.

So go utility window of nib.
Select First tab of utility window.
Remove autolayout and run the application

这篇关于在iOS6,XCode 4.5中,尽管设置了contentSize,但UIScrollView不是滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆