0

我使用界面构建器创建了一个新的 UIScrollView,我放置了一个带有长文本的标签,滚动条正在显示和滑动,尽管内容变得粘滞并且在滚动时没有隐藏

截图 [ 1 ] [ 2 ]

- (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.

}
4

4 回答 4

1

确保“标题”标签是滚动视图的子视图。

在我看来,它与滚动视图处于同一级别而不是在其下方是错误的。

它应该是什么样子

在您的屏幕截图中,显示了第二个问题:文本显示不正确。确保使用 Interface Builder 将标签连接到“textLabel”属性。

于 2012-07-25T11:29:06.757 回答
0

确保滚动视图大小小于 contentSize

于 2012-07-25T11:30:47.240 回答
0

您需要从属性检查器中为界面构建器中的滚动视图勾选“垂直反弹”。

于 2013-04-09T08:25:00.517 回答
0

这是因为在 ios 6 上使用了 xcode 4.5,它为每个 UIView 子类添加了约束并导致该问题,通过从早期版本的 XCode 创建视图来解决。

于 2012-07-25T20:38:43.957 回答