如何在动画后执行代码?

时间:2012-12-10 08:59:59

标签: objective-c xcode4.5

我有这个简单的代码:

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    BGEditTextField * theTableViewCell = (BGEditTextField *) [self.tableView cellForRowAtIndexPath:indexPath];
    theTableViewCell.displaytextField =true;
    [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
    //self.helpFinishUpdating.viewNotToCover = theTableViewCell;
}

除了我想要的一切之外,一切都很完美

self.helpFinishUpdating.viewNotToCover = theTableViewCell

在执行后执行 [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];已完成。

我将如何实现这一目标?

我之所以这样做是因为self.helpFinishUpdating.viewNotToCover = theTableViewCell;UITableViewCell的框架位置很敏感。我希望UITableViewCell在执行之前先到达最终位置。

1 个答案:

答案 0 :(得分:1)

UITableViewDelegate符合UIScrollViewDelegate,因此您只需实施scrollViewDidEndDecelerating:或任何符合您需求的内容。