在我的应用程序中,当我单击我时RightBarButtonItem,它会推送另一个视图控制器,但它显示以下错误。
-[__NSCFString _forgetDependentConstraint:]: unrecognized selector sent to instance 0x74c5960
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _forgetDependentConstraint:]: unrecognized selector sent to instance 0x74c5960'
我不知道我做错了什么。
但是在那个视图控制器中,我只把这段代码放在viewDidLoad第二个视图控制器中
            [self.navigationController setNavigationBarHidden:TRUE animated:YES]; 
        first view controller contains the following code
        - (void)viewDidLoad
        {
            [super viewDidLoad];
            [self.navigationController setNavigationBarHidden:TRUE animated:YES];
        baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 416)];
            UINavigationBar *navBar1 = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
            UINavigationItem *navItem1 = [[UINavigationItem alloc] initWithTitle:@""];
            [navBar1 pushNavigationItem:navItem1 animated:NO];
            UIBarButtonItem *menuButton1 = [[UIBarButtonItem alloc] initWithTitle:@""
                                                                            style:UIBarButtonItemStyleBordered
                                                                           target:self
                                                                           action:@selector(toggleMenu1)];
            navItem1.leftBarButtonItem = menuButton1;
            [baseView.self addSubview:navBar1];
            UIImageView *backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"scr2.png"]];
            [baseView.self addSubview:backgroundImage];
            UIPanGestureRecognizer *pancontrol = [[UIPanGestureRecognizer alloc]
                                           initWithTarget:self action:@selector(panLayer:)];
            [self.view addGestureRecognizer:pancontrol];
            topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 416)];
            UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
            UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@""];
            [navBar pushNavigationItem:navItem animated:NO];
            UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithTitle:@"Menu"
                                                 `enter code here`                         style:UIBarButtonItemStyleBordered                                                                  target:self
                                                                          action:@selector(toggleMenu)];
            navItem.leftBarButtonItem = menuButton;
            UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Add"
                                                                          style:UIBarButtonItemStyleBordered
                                                                         target:self
                                                                         action:@selector(toggleAdd)];
            navItem.rightBarButtonItem = addButton;
            [topView.self addSubview:navBar];
            backgroundImage1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"notebookbg.png"]];
            [topView.self addSubview:backgroundImage1];
            [baseView.self addSubview:topView];
            [self.view addSubview:baseView];
                }
这些是我的代码。
如何从第一个视图控制器移动到下一个视图控制器。