Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何删除以前的ViewController?_Objective C_Xcode_Uiview_Viewcontroller - Fatal编程技术网

Objective c 如何删除以前的ViewController?

Objective c 如何删除以前的ViewController?,objective-c,xcode,uiview,viewcontroller,Objective C,Xcode,Uiview,Viewcontroller,寻求帮助 我的项目: 我为孩子们做了一本书。 每个页面都是自定义的ViewController。 在每一页上,我都有一个下一页和上一页的按钮。 按下下一页按钮时,I“开关”/在AppDelegate中添加一个ViewController,如下所示: - (void)goToNextPage2 { self.view2 = [[ViewController2 alloc] init]; view2.view.frame = CGRectMake(769, 0, 768, 1024); [windo

寻求帮助

我的项目: 我为孩子们做了一本书。 每个页面都是自定义的ViewController。 在每一页上,我都有一个下一页和上一页的按钮。 按下下一页按钮时,I“开关”/在AppDelegate中添加一个ViewController,如下所示:

- (void)goToNextPage2 {
self.view2 = [[ViewController2 alloc] init];
view2.view.frame = CGRectMake(769, 0, 768, 1024);
[window addSubview:view2.view];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
view2.view.frame = CGRectMake(0, 0, 768, 1024);
[UIView commitAnimations];
}
如何以及在何处删除以前的Viewcontroller? 在这种情况下,它将是ViewController1。 有什么想法吗

提前谢谢
Planky

你没有提供太多信息…
无论如何,这可能会有帮助

在动画代码中:

[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
并添加该选项以删除ViewController:

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
    [self.view1.view removeFromSuperview];
    self.view1 = nil;
}

您没有提供太多信息…
无论如何,这可能会有帮助

在动画代码中:

[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
并添加该选项以删除ViewController:

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
    [self.view1.view removeFromSuperview];
    self.view1 = nil;
}

为什么要“删除”以前的视图?为什么要“删除”以前的视图?对不起,我没有足够的声誉。但当我有足够的钱时,我会的。答应我!对不起,我的名声不够好。但当我有足够的钱时,我会的。答应我!