问题
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