我能够以编程方式使其工作,但不使用 StoryBoard。这是一段简单的代码:
UIScrollView *topSV = [[UIScrollView alloc] initWithFrame:CGRectMake(100.0f, 100.0f, 600.0f, 600.0f)];
topSV.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
topSV.contentSize = CGSizeMake(2000.0f, 2000.0f);
UIScrollView *subSV = [[UIScrollView alloc] initWithFrame:CGRectMake(10.0f, 10.0f, 200.0f, 200.0f)];
subSV.backgroundColor = [UIColor whiteColor];
subSV.contentSize = CGSizeMake(2000.0f, 2000.0f);
[topSV addSubview:subSV];
[self.window addSubview:topSV];