1

我的视图控制器中有一个滚动视图。

我正在添加一个子视图

UIImageView *IMG1 = [[UIImageView alloc] init];
IMG1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMAGE.png"]];
[self.view addSubview:IMG1];
IMG1.frame = CGRectMake(20, 20, 35, 35);

所以问题是如何在我的滚动条下添加它(在滚动条和我的视图之间)?

4

1 回答 1

1

将此内容移动到 ViewDidLoad 并在 imageView 之后添加 scrollView

-(void) viewDidLoad
{
[super viewDidLoad]

UIImageView *IMG1 = [[UIImageView alloc] init];
IMG1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMAGE.png"]];
[self.view addSubview:MySubImage];
IMG1.frame = CGRectMake(20, 20, 35, 35);
  [self.view sendSubviewToBack:IMG1];
//// add your scrollView and subViews 
}
于 2013-10-11T06:18:19.857 回答