UIAlertView
버튼에서 UIViewController
을 열었지만 작동하지 않습니다. UIAlertView 버튼에서 뷰를 프로그래밍 방식으로 푸시?
사용자가 게임을 종료
나는 텍스트와 두 개의 버튼이있는UIAlertView
을 보여
"OK"가 경고를 기각하고 는 점수 페이지를 엽니 다을 "점수". 이 실제 UIAlertView
입니다 :
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"YOU WIN!"
message:[NSString stringWithFormat:@"You win a game in %d seconds!",seconds]
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:@"Score", nil];
[alert show];
을이 푸시의보기 코드 :
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Score"]){
ScoreViewController *score = [[ScoreViewController alloc]init];
[[self navigationController] pushViewController:score animated:YES];
}
}
는 내가 얻는 것은 완전히 검은 화면입니다. 누군가 나를 도울 수 있습니까? 나는 내가 잘못하고있는 것을 이해할 수 없다.
PS : ScoreViewController
에는 루트보기의 segue가 있지만 물론 경계보기 단추에서 프로그래밍 방식으로 segue를 수행하려고하므로 스토리 보드에서 새 항목을 만들 수 없습니다.
희망 나는 분명 도움이 될 것입니다.
segue를 수행하는 것처럼 보이지 않습니다. Storyboard segue를 프로그래밍 방식으로 수행하는 방법은'performSegueWithIdentifier : sender :' – hgwhittle
ops입니다. 죄송합니다. 이전에 segue로 시도했지만 작동하지 않았으므로 'google'및 'pushViewController : animated :'가 발견되어 코드를 변경하는 것을 잊었습니다. 내 질문을 편집하지만 'performSegueWithIdentifier : 보낸 사람 :'응용 프로그램 충돌 '스레드 1 : 신호 SIGABRT' –