2011-12-16 7 views
3

누군가가 Xcode 4.2의 새로운 스토리 보드를 이해할 수있게 도와 줄 수 있습니까?
나는 다른 뷰 컨트롤러를로드하는 코딩하는 방법을 알고 있지만 스토리 모드에서 차이가있다 ..Xcode 스토리 보드 스위치

나는 또한 navigationcontrollers에 대한 자습서 많이 알고,하지만 난 그냥 스토리 보드에 UIViewControllers를 전환 할 수 있습니다. 나는 RootViewController에서이 코드보기를 전환 할 수있는 일반 .xib 파일로

.. 나는 스토리 보드 모드에서 사용
 
SecondViewController *Second = [[SecondViewController alloc] initWithNibName:nil bundle:nil]; 
[self presentModalViewController:Second animated:YES]; 

는 그냥 SecondViewController.m하고 화면의 UIAlertView를로드 검은 색으로 보입니까?

SecondViewController *second= [self.storyboard instantiateViewControllerWithIdentifier:@"second"]; 
[self presentModalViewController:second animated:YES]; 

: 제이 루벤

답변

13

이 작업을 수행 할 수 -X-

어떤 도움을 주시면 감사하겠습니다

, 또한 Xcode 프로젝트를 부착 ...

Here is the zip ..

두 번째보기 컨트롤러에 "두 번째"와 같은 식별자를 지정하는 것을 잊지 마십시오.

그렇지 않으면 두보기 컨트롤러를 모두 연결할 수 있습니다. Ctrl 키를 누른 상태에서 첫 번째 컨트롤러에서 두 번째 컨트롤러로 드래그합니다. 지금 당신은 "푸시"를 선택하고 SEGUE이 같은 프로그램보기를 전환 할 수있는 이름을 지정할 수 있습니다 : 탐색 컨트롤러가 설정되어있는 경우

[self performSegueWithIdentifier:@"second" sender:self]; 

푸시 Segues에만 작동합니다.

+0

이것은 나를 도와 주었고, 많은 감사를드립니다! –

3

또한이 방법을 전환 할 수 있습니다

// get the view that's currently showing 
UIView *currentView = self.view; 
// get the the underlying UIWindow, or the view containing the current view 
UIView *theWindow = [currentView superview]; 

UIView *newView = aTwoViewController.view; 

// remove the current view and replace with myView1 
[currentView removeFromSuperview]; 
[theWindow addSubview:newView]; 

// set up an animation for the transition between the views 
CATransition *animation = [CATransition animation]; 
[animation setDuration:0.5]; 
[animation setType:kCATransitionPush]; 
[animation setSubtype:kCATransitionFromRight]; 
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

[[theWindow layer] addAnimation:animation forKey:@"SwitchToView2"]; 

sample project here를 다운로드합니다.

관련 문제