대답은 (만 밀어 수/팝 컨트롤러) "보기"에 의해 당신이 UIViewController에 언급하는 것으로 가정 그리고 당신은 네비게이션 컨트롤러의 pushViewController:animated:
선택하여이 컨트롤러를 호출하는 것을 .
그런 다음 .H 파일
@interface MyController : UIViewController <UIAlertViewDelegate> {
}
@end
당신이 당신의 컨트롤러 UIAlertViewDelegate
을 구현해야 감안할 때, 당신이 예에서 UIAlertView
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"No", nil];
[alert show];
[alert release];
을 만들 때 제대로 버튼의 인덱스를 확인해야합니다 위의 경우 "OK"버튼은 인덱스 0이고 "No"버튼은 인덱스 1입니다. 따라서 alertview:clickedButtonAtIndex:
대리자 메소드를 구현할 때 사용자가 오른쪽 버튼을 누른 다음 컨트롤러 팝 액션을 수행 할 수 있는지 확인할 수 있습니다.
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) { //button NO licked
[self.navigationController popViewControllerAnimated:YES];
}
}
편집 :
당신이 인스턴스를 확인하여 UINavigationController
, 그렇지 않으면 컨트롤러 navigationController
속성은
tabBarController = [[UITabBarController alloc] init];
tabBarController.view.frame = CGRectMake(0, 0, 320, 460);
NSMutableArray *controllers = [[NSMutableArray alloc] initWithCapacity:1];
ownerController *oController = [[ownerController alloc] init];
//navigation controller creation
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: oController];
[oController release];
//adds navigation controller to collection of controllers
[controllers addObject:nav];
[tabBarController setViewControllers:controllers];
[controllers release];
[self.view addSubview:[tabBarController view]];
설정 애니메이션 매개 변수 전무 NO에있을 것입니다 다음 –