我的didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[self.view removeFromSuperview];
[self.view.superview addSubview:commentsViewController.view];
[UIView commitAnimations]; }
我将我的CommentsViewController类添加到root .h文件中。 commentsViewController是此类的变量。单击我的超级视图后消失但新视图未插入。我的问题是什么?
答案 0 :(得分:3)
你正在调用self.view removeFromSuperView,之后你没有引用超级视图,因为你从superview中删除它,你必须先调用superview addSubView,然后从superView中删除self.view