-1

当在 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];

}

任何帮助表示赞赏。

4

1 回答 1

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");
    )];
于 2012-06-07T22:12:40.640 回答