Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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 用其他视图控制器替换占位符视图导致线程1:EXC\U BAD\U访问代码1_Objective C_Uiview_Uiviewcontroller_Exc Bad Access_Uistoryboardsegue - Fatal编程技术网

Objective c 用其他视图控制器替换占位符视图导致线程1:EXC\U BAD\U访问代码1

Objective c 用其他视图控制器替换占位符视图导致线程1:EXC\U BAD\U访问代码1,objective-c,uiview,uiviewcontroller,exc-bad-access,uistoryboardsegue,Objective C,Uiview,Uiviewcontroller,Exc Bad Access,Uistoryboardsegue,嘿,伙计们,使用本教程创建了一个自定义的segue选项卡栏 在试图弄明白为什么我的应用程序不能工作后,我意识到我使用的技术是将现有视图替换为链接的ViewController作为子视图 //////////////////////////////////////////重写的执行方法如下///////////////////////// -(void) perform { ViewController *src = (ViewController *)[self sourceView

嘿,伙计们,使用本教程创建了一个自定义的segue选项卡栏

在试图弄明白为什么我的应用程序不能工作后,我意识到我使用的技术是将现有视图替换为链接的ViewController作为子视图

//////////////////////////////////////////重写的执行方法如下/////////////////////////

-(void) perform  {

    ViewController *src = (ViewController *)[self sourceViewController];
    UIViewController *dst = (UIViewController *) self.destinationViewController;

    for (UIView *view in src.placeholderView.subviews ) {
        [view removeFromSuperview];
    }


    src.currentViewController = dst;
    [src.placeholderView addSubview:dst.view]; }
//////////////////////////////////////////////////////////////////////////////////////

现在,一旦我在链接的ViewController上,我希望向另一个ViewController添加另一个链接,该链接将保存每个ViewController信息的编辑功能。现在,当我尝试通过任何Segue连接ViewController时,应用程序崩溃,并给我一个线程1:EXC_BAD_访问。当我使用NSZombie时,它会在控制台中给我这个

[UIStoryboardSegueTemplate性能选择器:withObject:withObject:]:消息发送到解除分配的实例0x7c3a4d20

不,我从理论上理解发生了什么,viewController试图将下一个添加到一个空白处,我想整个占位符都被删除了,这样viewController就无处可去了,我想,我想知道是否有人能帮我解决这个问题,我是说我一直在到处寻找解决方案,但我总是遇到同样的错误

我甚至为ProfileViewController.m/ProfileViewController.h创建了一个VieController类,我在其中添加了

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([[segue identifier] isEqualToString:@"ProfileEditSegue"]){
        ProfileViewController *cvc = (ProfileViewController *)[segue destinationViewController];


        [cvc.placeholderView addSubview:cvc.view];
    }
}
这让我犯了同样的错误。我很乐意向任何人发送我的源文件,当我在教程中提供的文件上执行此操作时,也会发生相同的错误

另外,我使用这种方法是为了有一个垂直的导航栏,但我只想这样做,这样我就可以了解它是如何工作的,并能够进一步使用/开发它


任何帮助都很好

问题不在于这些方法,而是因为currentViewController实例被设置为弱而不是强