UIScrollView: Прокрутка не работает

Я хотел бы прокрутить свое содержание в UIScrollView. Но я думаю я сделанный ошибка.

    // setup view
CGRect appFrame = [UIScreen mainScreen].applicationFrame;
CGRect frame = CGRectMake(0, 0, appFrame.size.width, appFrame.size.height);
self.view = [[[UIView alloc] initWithFrame:frame] autorelease];

// setup wrapper
UIScrollView *wrapper = [[UIScrollView  alloc] initWithFrame:CGRectMake(0, 0, appFrame.size.width, appFrame.size.height + 320)];
wrapper.backgroundColor = [UIColor redColor];
wrapper.scrollEnabled = YES;
[self.view addSubview:wrapper];

// title (simple version here)
title.text = "Hello World";
[wrapper addSubview:title];
7
задан jv42 2 January 2012 в 14:38
поделиться

1 ответ

Вместо установки большой рамки нужно установить размер содержимого UIScrollView:

UIScrollView *wrapper = [[UIScrollView  alloc] initWithFrame:
             CGRectMake(0, 0, appFrame.size.width, appFrame.size.height)];
wrapper.contentSize =CGSizeMake(appFrame.size.width, appFrame.size.height + 320);
7
ответ дан 7 December 2019 в 07:44
поделиться
Другие вопросы по тегам:

Похожие вопросы: