views:

17

answers:

1

I have to views. One on top of the other.

But i cannot click the subviews of the top view until I set the alpha of the bottom view to 0.0.

Why would that be? Is there some kind of work around?

Code involved

-(void)setUpOpponentsCardStartingPosition
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];

CGRect newF = deckCard.view.frame;

newF.origin.x -= CGRectGetWidth(newF);

deckCard.view.layer.transform = CATransform3DIdentity;
deckCard.view.frame = newF;
deckCard.view.alpha = 0.0;

[UIView commitAnimations];

playersCard.view.layer.transform = CATransform3DScale(CATransform3DIdentity, 0.97, 
0.97, 1.0);

opponentsCard.view.layer.transform = CATransform3DRotate(CATransform3DIdentity, -
    35*M_PI/180, 0.0, 1.0, 0.0);    
opponentsCard.view.layer.transform = 
    CATransform3DScale(opponentsCard.view.layer.transform, 0.65, 0.675, 1.0);   
opponentsCard.view.layer.transform = 
    CATransform3DTranslate(opponentsCard.view.layer.transform, 400, 0, 0);
opponentsCard.view.hidden = NO;
}

if i comment out the deckCard.view.alpha = 0.0; it wont let me interact with playersCard. This makes no sense to me since playersCard is on top.

Here is setup code for deckCard

-(void)setupDeckInBackground
{
deckCard.view.alpha = 0.0;

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];

deckCard.view.frame = playersCard.view.frame;
deckCard.view.alpha = 1.0;

deckCard.view.layer.zPosition = -1;
deckCard.view.layer.transform = CATransform3DMakeRotation(M_PI/180*5, 0, 0, 1);
deckCard.view.layer.transform = CATransform3DScale(deckCard.view.layer.transform, 
1.0, 1.0, 1.0);
deckCard.view.layer.transform = 
    CATransform3DTranslate(deckCard.view.layer.transform, 0, 0, -25);
[UIView commitAnimations];

}

Thanks -Code

A: 

I found that the solution was to use

deckCard.view.userInteractionEnabled = NO;

Thanks, -Code

Code