2013-01-21 2 views
3

저는이 문제에 대한 해결책을 인터넷에서 찾고 있었지만 아직 이해할 수있는 것을 찾고 있습니다. 그래서 여기에 그것은 간다. 나는 응용 프로그램의 첫 번째 실행시 UIAlertView를 표시하는 내 iOS 응용 프로그램을 가지고 있습니다. 단추 중 하나가 새로운 viewController에 사용자를 보내서 필수 정보를 보길 원합니다.UIAlertView 버튼을 사용하여 viewController를 표시합니다.

내가 찍었을 내 UIAlertView 여기 actionSheet에 대한 코드입니다, 제대로 구성 :

- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
if (buttonIndex == 0) 
{ 

//Code to open a new viewController??? 


} 

if (buttonIndex == 1) 
{ 

//User can exit the application if they do not wish to continue 

exit(0); } 

} 
} 

나는의 ViewController가 webViewViewController라는 만들었습니다, 그게 내가 사용자가 첫 번째 버튼을 누를 때 도달 할 것입니다. 이 작업을 수행하는 방법에 대한 아이디어가 있습니까? 나는 ARC를 사용하지 못하게하고, 다른 '솔루션'은 내가 계속해서 오류를주고있다.

감사합니다. 여기에 몇 가지 안내가 있습니다. 현재의 ViewController가 탐색 컨트롤러에있는 경우

+0

첫째,'출구 (0)': 결코! 팁 : http://stackoverflow.com/questions/14335848/exit-application-when-click-button-ios 그런 다음 새 UIViewController를 인스턴스화하려면 Apple Doc가 유용해야합니다. – Larme

+0

나는 나쁜 소년이었습니다. 나는 그것을 바꿀 것입니다. 너 나 좀 도와 줄래? – iPwnTech

+0

경고보기를 표시하려면 먼저 rootView를 실행해야합니다. –

답변

0

는 :

UIViewController *myViewController = [[UIViewController alloc] init]; 
myViewController.title = @"My First View"; 
//to push the UIView. 
[self.navigationController pushViewController:myViewController animated:YES]; 

그리고 결코 종료를 사용 (0)!

+0

코드를 살펴 보겠습니다. 감사합니다! – iPwnTech

+0

모달 뷰 컨트롤러로 만들 수 있습니까? – iPwnTech

0
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
if (buttonIndex == 0) 
{ 

NewViewController *controller=[[NewViewController alloc]initWithNibName:@"NewViewController" bundle:nil]; 
      self.modalTransitionStyle=UIModalTransitionStyleCrossDissolve; 
      [self presentViewController:controller animated:YES completion:nil]; 



}   

drasick은 충분한 답변을 주었지만 모델보기 컨트롤러를 사용해야하는 경우 위를 참조하십시오.

+0

'알 수없는 수신기'와 '알 수없는 형식 이름'수신, 내보기 컨트롤러 이름은 webviewviewcontroller, 어떤 아이디어입니까? – iPwnTech

+0

forward는 .h 파일의 #import 대신 class @class className을 선언하고 순환 의존성을 피하기 위해 .m의 #import를 수행합니다. –

0

사용 :.

UIViewController *yourViewController = [[UIViewController alloc] init]; 
[self.navigationController presentModalViewController:myViewController animated:YES]; 

가 (이 아이폰 OS 6 depriciated,하지만 작동합니다)를 modalViewController를 밀어 모든

관련 문제