Raz Guille Rosman
Raz Guille Rosman

Reputation: 39

Draw an UIImage on top of a subView and interact with a UIScrollView

I have a ViewController with a UIScrollView and 3 subviews. I've declared the size of the UIScrollView to have the 3 views by horizontal scrolling. I'm trying to draw a new image on top of each sub view and when the view will be scrolled I would like that the new image will be scrolled with the subview. Right now, I managed to draw the new image, but it remains static even when I scroll the views.

x = [button frame].origin.x;
y = [button frame].origin.y;
check = [[UIImageView alloc] initWithFrame:CGRectMake(x+100,y+100, 20, 20)];
check.image = [UIImage imageNamed:@"check.png"];    
[self.view addSubview:check];

Upvotes: 0

Views: 344

Answers (1)

DrummerB
DrummerB

Reputation: 40211

Don't draw it in your scroll view. Draw it in your custom UIImageView subclass. Or add subviews to your image views.

Upvotes: 1

Related Questions