当我在 Xcode 中制作和设置滚动视图时,它永远不会工作。它根本不会滚动并显示我的内容!我已经编码了它的后端,但不行!从 iOS 4 开始我就一直在使用这个教程:Devx Scrollview Tutorial
现在,我认为由于新 iPhone 上的新屏幕尺寸,它在 iOS 6 中被打破了。这是我一直在使用的后端代码:
scrollView.frame = CGRectMake(0, 0, 320, 520);
//---set the content size of the scroll view---
[scrollView setContentSize:CGSizeMake(320, 520)];
// Do any additional setup after loading the view.
Xcode 中的滚动视图大小为宽度:320,高度:520。
我究竟做错了什么?这可能是一些愚蠢的事情。
更新:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.overlay removeFromSuperview];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(keyboardWillShow:) name:
UIKeyboardWillShowNotification object:nil];
[nc addObserver:self selector:@selector(keyboardWillHide:) name:
UIKeyboardWillHideNotification object:nil];
tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(didTapAnywhere:)];
[self customizeAppearance];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"stone.png"]];
[scrollView setScrollEnabled:YES];
scrollView.frame = ([UIScreen mainScreen].bounds);
//---set the content size of the scroll view---
[scrollView setContentSize:CGSizeMake(320, 800)];
// Do any additional setup after loading the view.
}