2
UIViewController를 탐색 컨트롤러에 푸시 한 다음 UIBarButtonItem을 탐색 모음에 추가하여 카운트 다운 타이머를 표시하는 데 사용할 수 있습니다.UINavigation 컨트롤러에 푸시 된 UIViewController에 UIBarButtonItem을 추가하십시오.
UINavigationController *navController = [[Session sharedInstance] getNavigationController];
GamePlayViewController *gameController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil ];
UIBarButtonItem *timerBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
gameController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:timerBtn, nil];
[navController pushViewController:gameController animated:YES];
위 코드를 사용할 때 작동하지 않습니다. 또한 컨트롤러 자체에서 ViewDidload 메서드를 사용했지만 주사위를 사용하지 않았습니다. 난, 그 다음이 할 수있는 유일한 말한다 이러한 두 개체의 세부 사항을 볼 수
"to uncaught exception 'NSInvalidArgumentException', reason: 'Fixed and flexible space items not allowed as individual navigation bar button item. Please use the leftBarButtonItems (that's plural) property.'
*** First throw call stack:"
UIBarButtonItem *timerBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
self.navigationItem.rightBarButtonItem = timerBtn;
근무 감사합니다! –