我正在做什么创建 aUIImageView
并希望将其添加到 aUIScrollingView
作为其滚动内容,但它从未出现。所以我尝试了下面的代码,现在问题对我来说很清楚了。如何将子视图添加到另一个子视图?
//in myViewController.m
@synthesize scrollView = _scrollView;
- (void) viewDidLoad{
UIView* simpleView = [[UIView alloc] initWithFrame:CGRectMake(0,0,300,200)];
[simpleView setBackgroundColor: [UIColor BlueColor]];
[self.view addSubview: simpleView] //this would work, the simple view appears
[self.scrollView addSubview: simpleView] //this would not work, the simple view doesn't appear
}
scrollView 属性与情节提要中的 ScollView 挂钩,这是该控制器中唯一的东西