当前位置:  开发笔记 > IOS > 正文

NSInvalidArgumentException

如何解决《NSInvalidArgumentException》经验,为你挑选了1个好方法。

我添加了:(id)发件人后,我从这个例程中崩溃,所以我可以确定哪个按钮调用它.当设置为普通的旧toggleView3时,它可以很好地工作.当detailView切换回docView时发生崩溃.

'NSInvalidArgumentException', reason: '*** -[RootViewController toggleView3]: unrecognized selector sent to instance 0x524a00' 2009-04-07 12:29:44.421 eTarot[11405:20b] Stack:

-(IBAction)toggleView3:(id)sender{


    if (detailViewController == nil) {
        [self loadDetailViewController];
    }

    UIView *docView = docViewController.view;
    UIView *detailView = detailViewController.view;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:([docView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];

    if ([docView superview] != nil) {
        [detailViewController viewWillAppear:YES];
        [docViewController viewWillDisappear:YES];
        [docView removeFromSuperview];

        [self.view addSubview:detailView];
        [self.view insertSubview:detailNavigationBar aboveSubview:detailView];
        [docViewController viewDidDisappear:YES];
        [detailViewController viewDidAppear:YES];

    } else {
        [docViewController viewWillAppear:YES];
        [detailViewController viewWillDisappear:YES];
        [detailView removeFromSuperview];
        [detailNavigationBar removeFromSuperview];
        [self.view addSubview:docView];
        [detailViewController viewDidDisappear:YES];
        [docViewController viewDidAppear:YES];
    }
    [UIView commitAnimations];
}

Chuck.. 13

toggleView3当选择器的正确名称toggleView3:- 即带冒号和参数时,您正在发送视图消息.它们可能与您相似,但它们与Objective-C完全不同.



1> Chuck..:

toggleView3当选择器的正确名称toggleView3:- 即带冒号和参数时,您正在发送视图消息.它们可能与您相似,但它们与Objective-C完全不同.

推荐阅读
mobiledu2402851323
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有