Ios 是否更改子视图的所有者?
我正在尝试实现一个动画,其中UITableViewCell的图像将展开以填充整个视图。我已经记下了基本知识,但图像被卡在导航栏后面。如何更改UIImageView以使其成为当前视图的子视图 这是我目前拥有的动画:Ios 是否更改子视图的所有者?,ios,objective-c,uitableview,uiimageview,Ios,Objective C,Uitableview,Uiimageview,我正在尝试实现一个动画,其中UITableViewCell的图像将展开以填充整个视图。我已经记下了基本知识,但图像被卡在导航栏后面。如何更改UIImageView以使其成为当前视图的子视图 这是我目前拥有的动画: UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath]; UIImageView *imageView = [cell viewWithTag:1]; UIView *cellView = [cell v
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”中。