2011-10-19 15 views
4

2番目のレベルでSplitViewControllerを実装する方法。2番目のレベルでSplitViewControllerを実装する方法。

実際には、ログインページとログイン後にアプリを起動する必要があります。私はSplitViewControllerが必要です。

+0

[ここ](http://stackoverflow.com/questions/4213097/best-way-to-switch-between-uisplitviewcontroller-and-other-view-controllers/25979945#25979945)は、私がこの種の状況、助けてくれる希望。 – tadija

答えて

0

これは私がそれを行う方法です。最初のviewContorllerをウィンドウから削除してsplitViewに置き換えることにより、ウィンドウのサイズを変更することができます。

splitViewController = [[SplitViewController alloc]init]; 
    // remove the current view and replace with splitViewController 
    [theWindow addSubview:splitViewController.view]; 

    // Transition handling 
    NSString *subtypeDirection; 
    switch ([[UIApplication sharedApplication] statusBarOrientation]) { 
     case UIDeviceOrientationPortrait:subtypeDirection = kCATransitionFromRight;break; 
     case UIDeviceOrientationPortraitUpsideDown:subtypeDirection = kCATransitionFromLeft;break; 
     case UIDeviceOrientationLandscapeLeft:subtypeDirection = kCATransitionFromTop;break; 
     case UIDeviceOrientationLandscapeRight:subtypeDirection = kCATransitionFromBottom;break; 
     default: NSLog(@"break at subType direction");break; 
    } 

    CATransition *animation = [CATransition animation]; 
    [animation setDuration:.5]; 
    [animation setType:kCATransitionPush]; 
    [animation setSubtype:subtypeDirection]; 
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 
    [[theWindow layer] addAnimation:animation forKey:@"SwitchToSplitView"]; 

    [self.navigationController.view removeFromSuperview]; 

ここではほとんどの行がトランジションと処理の回転を扱います。

selfは、最初のViewControllerを指し、theWindowは、アプリケーションウィンドウを指します。

:私は次のことをやっている> splitviewコントローラ - 同じログインについて[self superView];

0

:あなたはによってそれに得ることができます。サブクラスUIStoryboardSegueとオーバーライドperform

@implementation SSPushSegue 

- (void)perform 
{ 
    UIWindow* window = [self.sourceViewController view].window; 

    // Transition handling 
    NSString *subtypeDirection = kCATransitionFromRight; 
    switch ([UIApplication sharedApplication].statusBarOrientation) 
    { 
     case UIDeviceOrientationPortraitUpsideDown: subtypeDirection = kCATransitionFromLeft; break; 
     case UIDeviceOrientationLandscapeLeft: subtypeDirection = kCATransitionFromTop; break; 
     case UIDeviceOrientationLandscapeRight: subtypeDirection = kCATransitionFromBottom; break; 
     default: break; 
    } 

    CATransition *animation = [CATransition animation]; 
    animation.duration = .5; 
    animation.type = kCATransitionPush; 
    animation.subtype = subtypeDirection; 
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
    [window.layer addAnimation:animation forKey:NSStringFromClass([self class])]; 

    window.rootViewController = self.destinationViewController; 
} 

@end 

B。初期View Controllerから "Custom Segue"をDestinationに追加し、サブクラス名をプロパティフィールドに入力します。

+0

スプリットビューの前に別のビューコントローラーを作成してからsplitviewcontrollerに接続する必要がありましたか?これを理解しようとしている私は、約2日後に脳を動かして動作させるようになった。私のストーリーボードは、このUINavigation>ログイン> SplitView> Uinavigation(masterview)/ MainDashboard(detailview)のように見えます。私がしたことは、ログインからプッシュすることでしたが、それは何もしません。 – gdubs

関連する問題