2番目のレベルでSplitViewControllerを実装する方法。2番目のレベルでSplitViewControllerを実装する方法。
実際には、ログインページとログイン後にアプリを起動する必要があります。私はSplitViewControllerが必要です。
2番目のレベルでSplitViewControllerを実装する方法。2番目のレベルでSplitViewControllerを実装する方法。
実際には、ログインページとログイン後にアプリを起動する必要があります。私はSplitViewControllerが必要です。
これは私がそれを行う方法です。最初の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];
:あなたはによってそれに得ることができます。サブクラス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に追加し、サブクラス名をプロパティフィールドに入力します。
スプリットビューの前に別のビューコントローラーを作成してからsplitviewcontrollerに接続する必要がありましたか?これを理解しようとしている私は、約2日後に脳を動かして動作させるようになった。私のストーリーボードは、このUINavigation>ログイン> SplitView> Uinavigation(masterview)/ MainDashboard(detailview)のように見えます。私がしたことは、ログインからプッシュすることでしたが、それは何もしません。 – gdubs
[ここ](http://stackoverflow.com/questions/4213097/best-way-to-switch-between-uisplitviewcontroller-and-other-view-controllers/25979945#25979945)は、私がこの種の状況、助けてくれる希望。 – tadija