This code loops through adding a subview to the current subview (it is a card game)…
//Creates the Card's view and adds it to the cardContainerView
CardView *cardView = [[CardView alloc]initWithFrame:CGRectMake(0, 0, 67,99)];
[cardContainerView addSubview:cardView];
//Assign the UIGesture to the CardView
//For panning and dragging
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePanGesture:)];
[cardView addGestureRecognizer:panGesture];
…once the deal is done, I want to pick a card with a touch gesture and drag it – during this sequence I want that card to be hovering over all other cards (like in solitaire where you want to add a card from one column to another)
I think all you need to do is something like this:
in handlePanGesture:
If
touchedView.superviewdoesn’t work, you might want to consider making cardContainerView a property of your class and access it as such in yourhandlePanGesture:method.