我使用界面构建器创建了一个新的UIScrollView,我添加了一个带有长文本的标签,滚动条显示并滑动,尽管内容变得粘滞并且在滚动时没有隐藏
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
title.text = @"hellllllo world hellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo worldhellllllo world";
scrollview.contentSize =
CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+600);
//scrollview.maximumZoomScale = 4.0;
//scrollview.minimumZoomScale = 0.75;
scrollview.clipsToBounds = YES;
// scrollview.bounces = YES;
scrollview.superview.autoresizesSubviews = NO;
//scrollview.delegate = self;
[scrollview setScrollEnabled:YES];
// Do any additional setup after loading the view.
}
答案 0 :(得分:1)
确保“标题”标签是滚动视图的子视图。
在我看来,与滚动视图处于同一级别而不是在其下方是错误的。
在屏幕截图中,显示第二个问题:文本显示不正确。确保使用Interface Builder将标签连接到“textLabel”属性。
答案 1 :(得分:0)
确保滚动视图大小小于contentSize
答案 2 :(得分:0)
这是因为对于ios 6使用了xcode 4.5,它为每个UIView子类添加了约束并导致了这个问题,通过从早期版本为XCode创建视图来解决。
答案 3 :(得分:0)
您需要在“属性”检查器中为“界面构建器”中的scrollView勾选“垂直弹跳”。