没有自动布局的滚动视图 [英] Scroll View without Auto Layout

查看:26
本文介绍了没有自动布局的滚动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我在 UIScrollView 中有按钮,当它们被点击时,它会在 UITextView 中显示文本.在我的应用程序中,我不能使用自动布局;但我的 UIScrollView 不起作用.

In my app I have buttons in a UIScrollView that when they are clicked it displays text in a UITextView. In my app I can't use auto layout; but my UIScrollView won't work.

当我没有打开使用自动布局"时,如何使用 UIScrollView?

How can I use UIScrollView when I don't have "use auto layout" on?

推荐答案

这对我有用:

.h

IBOutlet UIScrollView *scrollerName;

.m [viewDidLoad]

.m [viewDidLoad]

    [Scroller setScrollEnabled:YES];
    [Scroller setContentSize:CGSizeMake(x, y)];

self->Scroller.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin);

或者只是:

    [Scroller setScrollEnabled:YES];
    [Scroller setContentSize:CGSizeMake(x, y)];

这篇关于没有自动布局的滚动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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