iPhone UINavigation 문제-중첩 된 푸시 애니메이션으로 인해 탐색 모음이 손상 될 수 있음
다음과 같은 오류가 계속 발생합니다.
2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
여기 내가하고있는 일이 있습니다. 뷰 컨트롤러에서 특정 버튼을 눌렀을 때 다음을 호출합니다.
EventsViewController *viewController = [[EventsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
navController.navigationBar.tintColor = [UIColor blackColor];
[self presentModalViewController:navController animated:YES];
[viewController release];
[navController release];
그런 다음 EventsController에서 특정 버튼을 누르면 다음을 호출합니다.
SingleEventViewController *viewController = [[SingleEventViewController alloc] initWithEvent:[currentEvents objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
그런 다음 SingleEventViewController에서 특정 버튼을 누르면 다음을 호출합니다.
EventMapView* viewController = [[EventMapView alloc] initWithCoordinates];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];
그렇습니다. 중첩 된 푸시 애니메이션이 있다는 것은 분명합니다.하지만 이것이 올바른 방법이 아닐까요? Apple의 DrillDownSave 코드를 확인했는데 이것이 그들이하는 방식 인 것 같습니다. viewDidLoad 메서드 대신 init 메서드를 사용하는 것이 중요합니까?
pushViewController전에 전화하는 viewDidAppear것은 안전하지 않습니다.
실수로 동일한 세그먼트를 두 번 트리거링 코드에서 한 번, 인터페이스 빌더에서 한 번, 둘 다 동시에 ...
나머지 분들과 같은 오류가 발생했습니다. 내 문제는 우연히 같은 segue를 두 번 발사했다는 것입니다. 인터페이스 빌더에서 한 번, 내 코드 내에서 한 번.
UITableView가 있습니다. 셀을 선택하면 인터페이스 빌더의 segue가 실행됩니다. 여기에 내 문제가 있는데, 인터페이스 빌더 내부의 셀 자체를 클릭하여 직접 실행되도록 설정 한 segue를 설정 한 다음 코드에서 didSelectRowAtIndexPath 아래에 동일한 segue를 실행하는 코드를 가졌습니다.
[self performSegueWithIdentifier:@"MySegue" sender:tableView];
즉, 행이 선택되어 didSelectRowAtIndexPath가 호출되면 위의 코드 행으로 segue가 실행됩니다. 그런 다음 인터페이스 빌더는 인터페이스 빌더의 셀 개체에 직접 연결되어 있기 때문에 segue도 트리거합니다. 인터페이스 빌더가 segue를 직접 실행하는 것을 중지합니다. 셀 자체에서 나오는 내부에 중첩되지 않고 뷰 컨트롤러의 상단에서 segue를 연결해야합니다.
따라서 나와 같은 이유로이 문제가 발생하는 경우, 즉 동일한 segue를 두 번 호출하는 경우 셀에서 segue로 직접 연결을 해제하고 segue 연결이 셀 내부에 중첩되지 않고 IB에서 테이블 계층의 맨 위에 있습니다. View Controller 자체의 segue를 segue에 연결하십시오. 이 작업을 올바르게 수행 한 경우 segue를 선택할 때 셀뿐 아니라 전체보기가 강조 표시되어야합니다.
이제 Apple의 문서는 performSegueWithIdentifier : sender : reference 아래에 있습니다.
앱은 일반적으로 segue를 직접 트리거 할 필요가 없습니다. 대신 뷰 계층에 포함 된 컨트롤과 같이 뷰 컨트롤러와 연결된 인터페이스 빌더에서 개체를 구성하여 segue를 트리거합니다. 그러나 스토리 보드 리소스 파일에서 지정할 수없는 일부 작업에 대한 응답으로이 메서드를 호출하여 프로그래밍 방식으로 segue를 트리거 할 수 있습니다. 예를 들어 흔들림 또는 가속도계 이벤트를 처리하는 데 사용되는 사용자 지정 작업 처리기에서 호출 할 수 있습니다.
제 경우에는 UITableView에 대한 검색 버튼이 있고 검색 결과 테이블이 있거나 일반 테이블 뷰가있을 때 segue가 호출되는지 여부를 결정해야했습니다. 그래서 나는 segue를 직접 트리거해야했습니다.
따라서 인터페이스 빌더에서 임베디드 컨트롤을 제거하고 뷰 컨트롤러 자체에 붙인 다음 코드에서 segue를 트리거하십시오!
이제 더 이상 이중 segues가 없습니다! 그리고 더 이상 오류가 없습니다.
도움이 되었기를 바라며이 문제를 해결하는 데 몇 시간이 걸렸습니다.
방금했던 것과 동일한 문제 / 오류 메시지가 있었는데, 해결책을 찾고 있었고 결국이 스레드에서 끝났지 만, 저에게는 해결책이 실제로 하나의 애니메이션 만 있음을 발견했습니다. 애니메이션 넣어 : 최종 푸시에 대해서만 예), 도움이되기를 바랍니다.
건배.
나는 그것을 알아 냈다. 분명히 UITableViewDelegate의 -didSelectRowAtIndexPath 메서드 외부에서 -pushViewController를 호출하면 작동하지 않습니다. 해당 함수로 호출을 이동했습니다. 기묘한.
펜촉의 버튼이 두 가지 다른 동작에 연결되어 발생한 동일한 문제가 발생했습니다. 두 뷰 컨트롤러를 모두로드하려고 시도하여 스택이 손상되었습니다.
viewDidLoad 메서드 대신 init 메서드를 사용한다고하면 무슨 의미입니까?
이전 푸시가 조치를 취하기 전에 새 뷰 컨트롤러를 푸시하는 경우 이러한 종류의 오류가 발생합니다. 따라서 특정 코드를 init에 넣고 조기에 작업을 수행하면 오류가보고 될 수 있습니다.
init이 뷰 컨트롤러에서 실행되는 시점에서 뷰는 아직로드되지 않았습니다!
음 나는이 문제가 있었고 전체 iOS 개발 장면을 처음 접했습니다. 그러나 인터페이스 빌더에서 내 연결 검사기 (파일 소유자 포함)를 살펴본 후 버튼을 복사했을 때 이전 버튼 방법과 내가 만든 새 방법이 할당되어 있음을 알았습니다. 내 문제의 중첩 측면이 발생한 곳이라고 생각합니다. 두 가지 방법 모두 Nav 컨트롤러에 뷰를 푸시했기 때문입니다. 나는 이것이 이미 대답되었다는 것을 알고 있지만 다른 사람이 나와 같은 어리석은 실수를 할 경우를 대비하여 이것을 올릴 것이라고 생각했습니다.
이것은 이미 답변되었지만 동일한 오류가 발생했지만 테이블보기를 사용하지 않고 다른 사람들에게 도움이 될 것이라고 생각했습니다. 나는 마침내 문제를 알아 냈다.
IBAction이 pushViewController를 호출 한 기존 버튼이 있습니다. 기존 버튼을 복사하여 새 버튼을 만들었습니다. 새 버튼에는 pushViewController를 호출하는 작업도 있습니다. 새 버튼을 탭하고 (내부 터치 업) 뷰 컨트롤러를 눌렀을 때이 오류가 발생했습니다. 새 버튼을 삭제하고 처음부터 새로 만든 다음 기존 콘센트 및 작업에 바인딩하면 오류가 사라졌습니다.
같은 문제가 발생했습니다. 제 경우에는 switch 문에 휴식이 없어서 두 개의 segue가 동시에 해고되었습니다. 나를 위해 쉬운 수정.
내 문제는 키보드가 활성화되는 것과 관련이 있습니다.
이것은 textField의 델리게이트 메서드에서 ViewController를 밀어서 발생했습니다.
-(void)textFieldDidBeginEditing:(UITextField *)textField{
FilterLocationViewController *destViewController = (FilterLocationViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"FilterLocationViewController"];
[self.navigationController pushViewController:destViewController animated:YES];
}
코드를 다음과 같이 변경합니다.
-(void)textFieldDidBeginEditing:(UITextField *)textField{
[_textFieldLocation resignFirstResponder]; //adding this line
FilterLocationViewController *destViewController = (FilterLocationViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"FilterLocationViewController"];
[self.navigationController pushViewController:destViewController animated:YES];
}
(줄 추가 [textField resignFirstResponder];) 문제가 사라졌습니다.
Basically the lesson is that you shouldn't modify the navigationController stack if the keyboard is out.
Recently, I've faced the same problem. The reason was: -I was trying to pop view controller twice by mistake. you can check this crash by setting breakpoints on push and pop View controllers
1) Perhaps you could try passing the necessary variables as properties before pushing the UIViewController rather than using the init methods with parameters. Most likely you will need these parameters beyond your init method anyway.
Also, in your initWithCoordinates: method you are missing the parameters. Possibly your custom init methods are a part of the problem.
2) Just because you mentioned viewDidLoad -- this method is for initialization after a view has loaded . If you create the UIViewController in code, as it seems you do, you should use loadView to set up your subviews.
This was happening for me because of my UIControlEvents
[button addTarget:self action:@selector(callSecondView) forControlEvents:UIControlEventAllTouchEvents];
I had to change the UIControlEventAllTouchEvents to UIControlEventTouchUpInside or however you want your button to work if you had the issue because of a UIButton call.
My Solution was
[self performSelector:@selector(moveTo) withObject:nil afterDelay:0.5];
Don't know about other's. I think most of the People using StoryBoard is facing such Problem. I am using XIB.
In my case The Problem Was, when I was moving to another view using push, I was also using
[self.navigationController popViewControllerAnimated:YES];
in the ViewWillDisappear of the current View at the same time. Just remove it and it works fine.
I was using POP, because of the requirement and the Flow. The Hierarchy was 1 -> 2 ->3
I was on view 2 and wanted to move to view 3. In that case I encountered this error.
In my case I was both setting the push segue from the storyboard and programatically. Hopefully that'll help anyone
I had this error message too, and the navigation bar and navigation controller transitions were weird. My setup was a bunch of Navigation Controllers embedded in a Tab bar Controller. The problem was that I didn't call super.viewDidLoad() in my Tab bar Controller implementation of viewDidLoad.
Calling super is something the docs clearly point out that you should do when overriding viewDidLoad, and I learned this the hard way.
Maybe this can help someone else too!
I know that this was answered, but it could help others.
I had the same problem, but it was caused because I was using a bad event for an info button. I was using "UIControlEventAllTouchEvents" and this generated two push of the same view into the navigation controller. The correct event was "UIControlEventTouchUpInside". I'm new to iOS.
This resolves the problem: https://github.com/nexuspod/SafeTransition
If you push (or pop) a view controller with animation(animated:YES) it doesn't complete right away, and bad things happen if you do another push or pop before the animation completes.
To reproduce this bug, try pushing or popping two view controllers at the same time. Example:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIViewController *vc = [[UIViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
You will receive this error:
2014-07-03 11:54:25.051 Demo[2840:60b] nested push animation can result in corrupted navigation bar 2014-07-03 11:54:25.406 Demo[2840:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Just add the code files into your project and makes your navigation controller as a subclass of APBaseNavigationController, and you'll be good to do.
Just to complete the list, here is another reason which can cause "nested push animation can result in corrupted navigation bar":
I did setup several NavigationController within a TabBarController and set the selectedIndex within the storyboard Identifiy Properties. After moving active Tab to Code error disappeared.
'Program Club' 카테고리의 다른 글
| 다른 테이블과 조인하지 않는 행을 제외하는 방법은 무엇입니까? (0) | 2020.11.02 |
|---|---|
| git pull에 대한 Git 오류 (로컬 참조를 업데이트 할 수 없음) (0) | 2020.11.02 |
| Android에서 메뉴를 툴바로 설정하는 방법 (0) | 2020.11.02 |
| MAC OS X el capitan에서 brew를 업데이트 할 수없고`require`로로드 오류가 계속 발생합니다. (0) | 2020.11.02 |
| CamelCase 분할 (0) | 2020.11.02 |