1

当用户点击一个单元格时,我正在为表格视图设置动画。虽然我的 DidSeclectRowAtIndexPath 在我第一次点击单元格时被调用,但动画没有发生。在第二次点击时,动画块被触发。什么可能导致此问题?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    self.ChosenSubCategory=[self.SubCategoryListArray objectAtIndex:indexPath.row];
    [self getUserSpecificLevelDetails];
   // [self ShowLevelPickerView];

    [UIView animateWithDuration:1.0 animations:^{
             [self.ChooseLevelView setCenter:CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2)];
        [player prepareToPlay];
        [player play];
    }];


}
4

1 回答 1

0

可能是因为线程问题。

请尝试以下解决方案。希望它有效。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 

*)indexPath
{
    self.ChosenSubCategory=[self.SubCategoryListArray objectAtIndex:indexPath.row];
    [self getUserSpecificLevelDetails];
   // [self ShowLevelPickerView];

    [self performSelector:@selector(performOperation) withObject:nil afterDelay:0];
}


- (void)performOperation
{
      [UIView animateWithDuration:1.0 animations:^{
             [self.ChooseLevelView setCenter:CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2)];
        [player prepareToPlay];
        [player play];
    }];`
}
于 2013-05-01T10:52:28.583 回答