【发布时间】:2015-03-26 18:35:49
【问题描述】:
我正在尝试实现一个动画,其中UITableViewCell 的图像展开以填满整个视图。我已经掌握了基础知识,但图像卡在navigationBar 后面。如何更改UIImageView 使其成为当前视图的subView?
这是我目前拥有的动画:
UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
UIImageView *imageView = [cell viewWithTag:1];
UIView *cellView = [cell viewWithTag:2];
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^(void)
{
imageView.contentMode = UIViewContentModeScaleAspectFill;
[cellView bringSubviewToFront:imageView];
[imageView setFrame:CGRectMake(0, -64, self.view.frame.size.width, self.view.frame.size.height+64)];
}
completion:^(BOOL finished)
{
if(finished)
{
[self.navigationController presentModalViewController:readerViewController animated:YES];
}
}];
【问题讨论】:
-
只需致电
[someOtherView addSubview:imageView];。这会将其从当前父视图中移除,并将其添加到您选择的任何“someOtherView”中。
标签: ios objective-c uitableview uiimageview