Inside my UIScrollView I've got a view. Within this view there are several images. I'd like to drag the images out of my scroller (and view) to the mainview. However getting the images in front of the scroller and view is driving me bonkers.
This is a piece of my code:
Code:
- (void)viewDidLoad{
//scroller properties
scroller.contentSize = CGSizeMake(1300, 130);
scroller.scrollEnabled = YES;
scroller.directionalLockEnabled =YES;
scroller.frame = CGRectMake(0, 874, 768, 130);
[scroller setDelegate:self];
UIView *contentContainer = [[UIView alloc] init];
[scroller addSubview:contentContainer];
[scroller addSubview:image1];
[scroller bringSubviewToFront:image1];
[speler1 release];
UILongPressGestureRecognizer *longPress1 =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressed:)];
[image1 addGestureRecognizer:longPress1];
[longPress1 release];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setMaximumNumberOfTouches:1];
[panRecognizer setDelegate:self];
[image1 addGestureRecognizer:panRecognizer];
}
-(void)longPressed:(UILongPressGestureRecognizer *)sender {
[[self.view superview] bringSubviewToFront:image1];
}
-(void)move:(id)sender {
//move the image
}
I'd like to bring the images in front of the views by using a LongPressGestureRecognizer. The PanGestureRecognizer takes care of moving the image. The dragging works only inside the scrollview. Anyone knows how to bring my images in front of the views?
Help is greatly appreciated