当我在uiview中存在的uitableview中点击一个单元格时,我会使用此代码,但是当用户点击它时,它不会执行应该在单元格上执行的“flash”。
-(IBAction)labelTap:(UIGestureRecognizer *)sender
{
if(sender.state != UIGestureRecognizerStateRecognized)
return;
UIView *tappedview=[sender.view hitTest:[sender locationInView:sender.view]
withEvent:nil];
UIView *contentview1=tappedview.superview.superview;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[contentview1 setAlpha:0];
[contentview1 setAlpha:1];
[UIView commitAnimations];
}
任何帮助表示感谢。
答案 0 :(得分:0)
试试这个有效!
UIView *contentview1=tappedview.superview;
[contentview1 setAlpha:0];
[UIView animateWithDuration:0.3f
animations:^(void)
{
// Animate the flash on tap
[contentview1 setAlpha:1];
}
completion:^(BOOL finished)
{
NSLog(@"Done! Now show the pop up");
)];