다른 유형의 표보기 셀이있는 표보기가 있습니다. 셀 중 하나에는 두 개의 버튼이 있는데, 누르면 눌렀을 때보기 컨트롤러가로드됩니다. 버튼을 처리하기 위해 다음 함수를 사용하고 있습니다 :iOS segue가 두 번 실행되었습니다.
- (IBAction)leftButtonPressed:(id)sender
{
// Getting the pressed button
UIButton *button = (UIButton*)sender;
// Getting the indexpath
NSIndexPath *indPath = [NSIndexPath indexPathForRow:button.tag inSection:0];
// Loading the proper data from my datasource
NSArray *clickedEvent = [[[SOEventManager sharedEventManager] eventsArray] objectAtIndex:indPath.row];
[[SOEventManager sharedEventManager] setSelectedEvent:clickedEvent[0]];
// Everything working as it should up to this point
// Performing seque...
[self performSegueWithIdentifier:@"buttonSegue" sender:self];
}
내 buttonSegue는 새로운보기 컨트롤러를 푸시해야합니다. 어떻게 든 대신 한 번 밀어이 두 번 밀어 것으로 보인다, 그래서 나는 다음과 같은 경고 얻을 : 내 경우
2013-11-27 01:48:30.894 Self-Ordering App[2081:70b] nested push animation can result in corrupted navigation bar
2013-11-27 01:48:31.570 Self-Ordering App[2081:70b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
I 앱이 바로 팝업하고자하는 이벤트가 있기 때문에 그것이 충돌로 연결을 보기 컨트롤러 그래서 내 테이블보기로 돌아갑니다. 나는이에 대한 alertview을 사용하여 다음과 같이 이벤트를 처리 : 그것은 나에게 흥미로운 내 "일반"테이블 뷰 셀에서 다른 SEGUE을주의 할 수도
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex];
// ...
// Additional checking of button titles....
else if ([buttonTitle isEqualToString:NSLocalizedString(@"Vissza", nil)])
{
[self.navigationController popViewControllerAnimated:YES];
}
}
, 그 경우 나는 prepareForSegue를 사용 : 메서드
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"detailSegue"])
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
SOEvent *selectedEvent = [[[SOEventManager sharedEventManager] eventsArray] objectAtIndex:indexPath.row];
[[SOEventManager sharedEventManager] setSelectedEvent:selectedEvent];
}
}
이 경우 뷰 컨트롤러는 완벽하게 푸시되고 필요하다면 즉시 팝업됩니다. 나는 iOS7과 Xcode 5에서 이것을 테스트하고있다. 나는 전에 이런 문제가 발생하지 않았으므로, 어떤 도움이 크게 감사 할 것이다.
인터페이스 빌더에서 동작을 올바르게 연결 했습니까? 어쩌면 당신은 사건을 내부로 만지기보다는 내부를 터치하고 내부를 만지기 위해 유선으로 연결했을 것입니다. 또는 인터페이스 빌더에서 코드와 다시 모두에서 segue를 할당했을 수도 있습니다. 당신이 그걸 확인 했니? 그것은 흔한 실수입니다. –
오, 빌어 먹을. 당신이 실제로 맞아, 내 테이블 버튼 데이터 소스 메서드도 할당 .. 귀하의 답변 주셔서 감사합니다! –