2013-06-07 3 views
0

수동으로 사용자 지정하는 기본보기로 시작하는 분할보기 응용 프로그램을 만들어야합니다. 그런 다음 SplitView로 전환하거나 마스터/세부 테이블보기를 스택으로 밀어 넣어 구현해야합니다.선행보기가있는 마스터/세부 프로젝트

내가 사용하려는 전략은 SplitView 컨트롤러의 세부 정보 창에 기본보기를 배치하는 것이고 거기에있는 동안 왼쪽 패널에 대한 측면 패널과 단추를 각각의 방향으로 숨길 수 있습니다.

더 좋은 방법이 있습니까? "일반"보기를 내 루트보기로 사용하여 프로그래밍 방식으로 UISplitView로 전환 할 수 있습니까?

전화 버전 - 이는 실제로 문제가되지 않습니다. 네비게이션 컨트롤러가 루트 뷰 컨트롤러이기 때문에 더 많은 뷰를 스택에 넣을 수 있습니다.

iPad의 경우 - UISplitView 컨트롤러를 탐색 스택에 푸시 할 수 없습니다. 나는 이것을 정말로하고 싶다. 그래서 나는 "뒤로"라는 개념을 가지고있다. 프로그래밍 방식으로 만들 수 있습니다 -하지만 전에 - 나는 그들이 존재한다면 다른 옵션에 관심이있을 것입니다.

이 애플리케이션에 스토리 보드를 사용하고 싶습니다. 타겟 버전은 ARC 용으로 iOS 5입니다.

+0

첫 번째 viewcontroller와 spliviewco 사이에서 rootViewController를 전환 해 보았습니다. 컨트롤러? – Mat

+0

@Mat yes. 그것이 내가 원래 생각한 한 가지 방법이었습니다. 스토리 보드를 사용하면서 원했던 것만 큼 잘 생기고 재생되지 않습니다. 현실적으로 - 아마도 그렇게해야 할 것입니다. 나는 기본적으로 아래의 제안을 시도 할 것입니다. – sylvanaar

답변

1

나는 응용 프로그램의 루트를 대체하여이 작업을 수행했습니다. 첫 번째 화면에 LoginViewController이 있고 로그인에 성공하면 ViewControllerUISplitViewController으로 전환했습니다. 당신도 이것을 움직일 수 있습니다.

편집 : 여기

UIStoryboardSegue 서브 클래스에서 내 코드입니다 :

- (void) perform 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; 

    UIViewController *sourceViewController = (UIViewController *)self.sourceViewController; 
    UISplitViewController *destinationViewController = (UISplitViewController *)self.destinationViewController; 

    UIWindow *window = appDelegate.window; 
    window.rootViewController = destinationViewController; 
    window.rootViewController = sourceViewController; 

    [UIView transitionWithView:sourceViewController.view.window 
         duration:0.5 
         options:UIViewAnimationOptionTransitionFlipFromLeft 
        animations:^{ 
         window.rootViewController = destinationViewController; 
        } 
        completion:^(BOOL finished){ 
        }]; 
} 
1

이 코드를 시도 : 당신은

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    { 


     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

     self.viewController = [[LogInViewController alloc] initWithNibName:@"LogInViewController" bundle:nil]; 


     self.window.rootViewController = self.viewController; 

      [self.window makeKeyAndVisible]; 
     return YES; 

    } 


and your loginButton Action: 

    -(IBAction)loginclick:(id)sender 
    { 
     objAppdelegate = (yourProjectnameDelegate *) [[UIApplication sharedApplication]delegate]; 
     NSMutableArray *array = [NSMutableArray array]; 

        HomeSpilitView = [[[UISplitViewController alloc] init]autorelease]; 

        HomeMster = [[HomeSpilitViewController alloc] initWithNibName:@"HomeSpilitViewController" bundle:nil]; 

        masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeMster] autorelease]; 
        [email protected]"Title home"; 
        masterNavigationController.navigationBar.tintColor =[UIColor colorWithRed:255/255.0 green:108/255.0 blue:61/255.0 alpha:0.1]; 
        [array addObject:masterNavigationController]; 


        HomeDetailsViewController *HomeDetailsViewControllers = [[HomeDetailsViewController alloc] initWithNibName:@"HomeDetailsViewController" bundle:nil]; 

        detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeDetailsViewControllers] autorelease]; 

        detailNavigationController.navigationBar.tintColor =[UIColor colorWithRed:255/255.0 green:108/255.0 blue:61/255.0 alpha:0.1]; 
        [email protected]"details title"; 
        HomeMster.objHomeDetailsViewcontroller=HomeDetailsViewControllers; 
        HomeSpilitView.delegate = HomeDetailsViewControllers; 

        [array addObject:detailNavigationController]; 

        [HomeSpilitView setViewControllers:array]; 

        [objAppdelegate.window setRootViewController:HomeSpilitView]; 


    } 


//===for animation 


    UIInterfaceOrientation interfaceOrientation = HomeSpilitView.interfaceOrientation; 
     NSString *subtypeDirection; 
     if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) { 
      subtypeDirection = kCATransitionFromTop; 
     } 
     else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
      subtypeDirection = kCATransitionFromBottom; 
     } 
     else { 
      subtypeDirection = kCATransitionFromRight; 
     } 
     [objAppdelegate.window setRootViewController:HomeSpilitView]; 
     CATransition *animation = [CATransition animation]; 
     [animation setDuration:0.5]; 
     [animation setType:kCATransitionPush]; 
     [animation setSubtype:subtypeDirection]; 
     [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

     [[objAppdelegate.window layer] addAnimation:animation forKey:@"SwitchToView1"]; 
위임

에서 루트 뷰 컨트롤러로 LoginViewcontroller을 추가 할 수 있습니다
관련 문제