我正在制作一个应用程序,当用户单击图像时,它会显示出来,然后是下一个代码。如您所见,它会使图像消失,然后我想将其从超级视图中删除。
这是代码:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.8f];
[UIView setAnimationDelay:1.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
tempImageView1.alpha = 0;
tempImageView2.alpha = 0;
[UIView commitAnimations];
[tempImageView1 removeFromSuperview];
[tempImageView2 removeFromSuperview];
//[self performSelector:@selector(removeFromSuperview) withObject:tempImageView1 afterDelay:1.8f];
//[self performSelector:@selector(removeFromSuperview) withObject:tempImageView2 afterDelay:1.8f];
令我困惑的是,如果我写 [tempImageView1 removeFromSuperview]; 该应用程序可以正常工作,但当然图像甚至在显示之前就关闭了。当我尝试编写上面注释的行之一时,做同样的事情但有延迟,我收到一条错误消息。
原因是:“[GamePage2 removeFromSuperview]: unrecognized selector sent to instance”