在我的应用程序中,当我单击我的RightBarButtonItem
时,它将推送另一个视图控制器,但它显示以下错误。NSCFString _forgetDependentDestradependentConstraint发送到实例的无法识别的选择器
-[__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];
}
这些都是我的代码。
如何从此第一个视图控制器移动到下一个视图控制器。
您在哪里调用此方法_forgetDependentConstraint? –
如果它在推入后中断,那么它会在你的'viewDidLoad'和可能在'viewDidAppear'或类似的地方崩溃。你知道它打破了什么路线吗? – John
嗨请粘贴一些mote代码... – Rajneesh071