Scroll View without Auto Layout

▼魔方 西西 提交于 2020-01-26 03:13:05

问题


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.

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


回答1:


This worked for me:

.h

IBOutlet UIScrollView *scrollerName;

.m [viewDidLoad]

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

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

or just:

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


来源:https://stackoverflow.com/questions/25298858/scroll-view-without-auto-layout

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!