在我的應用程序中,當我單擊我的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