View交互的奇怪错误

时间:2010-09-22 11:26:13

标签: iphone objective-c

我要观点。一个在另一个之上。

但是在我将底部视图的alpha设置为0.0之前,我无法点击顶视图的子视图。

为什么会这样?有什么工作吗?

涉及的代码

-(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;
}

如果我注释掉deckCard.view.alpha = 0.0;它不会让我与playerCard互动。这对我来说没有任何意义,因为球员卡是最重要的。

这是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];

}

由于 -code

1 个答案:

答案 0 :(得分:0)

我发现解决方案是使用

deckCard.view.userInteractionEnabled = NO;

谢谢, -code