문제

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