1

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)

MplsRich
  • 137
  • 1
  • 13
  • Did you read http://stackoverflow.com/questions/6672677/how-to-use-uipangesturerecognizer-to-move-object-iphone-ipad – akiniwa Feb 03 '13 at 04:26

1 Answers1

0

I think all you need to do is something like this:

in handlePanGesture:

- (void)handlePanGesture:(UIGestureRecognizer *)recognizer {

    UIView *touchedView = recognizer.view;
    [touchedView.superview bringSubviewToFront:touchedView];
    ... // Rest of your code here.
}

If touchedView.superview doesn't work, you might want to consider making cardContainerView a property of your class and access it as such in your handlePanGesture: method.

Simon Germain
  • 6,834
  • 1
  • 27
  • 42