Objective c 使用动画展开UITableViewCell

Objective c 使用动画展开UITableViewCell,objective-c,uitableview,uiview,uiimageview,Objective C,Uitableview,Uiview,Uiimageview,我正在尝试在我的UITableView中实现功能,其中UITableViewCell的UIImageView在用户触摸单元格后展开以填充整个视图 这是我正在使用的动画: UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath]; UIImageView *imageView = [cell viewWithTag:1]; UIView *cellView = [cell viewWithTag:2]; CGRect

我正在尝试在我的
UITableView
中实现功能,其中
UITableViewCell
UIImageView
在用户触摸单元格后展开以填充整个视图

这是我正在使用的动画:

UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
UIImageView *imageView = [cell viewWithTag:1];
UIView *cellView = [cell viewWithTag:2];

CGRect rectInTableView = [_tableView rectForRowAtIndexPath:indexPath];

[UIView animateWithDuration:0.5
                      delay:0
                    options:UIViewAnimationOptionCurveEaseIn
                 animations:^(void)
                     {
                         imageView.frame = rectInTableView;
                         imageView.tag = 123;
                         [self.navigationController.view addSubview:imageView];
                         [imageView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height+64)];
                         imageView.contentMode = UIViewContentModeScaleAspectFill;
                     }
                 completion:^(BOOL finished)
                     {}];

然而,现在发生的是,
UIImageView
跳到顶部,然后展开。我希望它能从细胞中扩展出来。我如何才能做到这一点?

这可能会实现您的目标:

UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
UIImageView *imageView = [cell viewWithTag:1];
UIView *cellView = [cell viewWithTag:2];

CGRect rectInTableView = [_tableView rectForRowAtIndexPath:indexPath];
imageView.frame = rectInTableView;
imageView.tag = 123;
[self.navigationController.view addSubview:imageView];

[UIView animateWithDuration:0.5
                      delay:0
                    options:UIViewAnimationOptionCurveEaseIn
                 animations:^(void)
                     {
                         [imageView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height+64)];
                         imageView.contentMode = UIViewContentModeScaleAspectFill;
                     }
                 completion:^(BOOL finished)
                     {}];

这就像它应该的那样工作,但是
UIImageView
现在具有单元格的x,y。我想把它扩展到x,y=0,0谢谢你的澄清。我已经更新了答案。