I have a scrollview in my view controller.

I'm adding a subview

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

So the question is how to add it under my scroller (between scroller and my view)?

有帮助吗?

解决方案

Move this content to ViewDidLoad and add the scrollView after imageView

-(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 
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top