вам нужно Impliment PPRevealSlideViewController
Как это вам проецировать: -
LoginPageViewController *login = [[LoginPageViewController alloc]initWithNibName:@"LoginPageView" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:login];
_revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav];
[self.window setRootViewController:_revealSideViewController];
я думаю, что в ваш код Вы добавляете два навигации контроллера вам необходимо добавить только одну навигационную CONTROLL в то время как вы добавляете PPRevealSideViewController
в основной контроллер pushview в self.window
Для примера вы можете достичь этого
на вас HomeViewcontroller push rightViewcontroller
вам нужно снова rightViewcontrollre как RootViewController как добавить #import <QuartzCore/QuartzCore.h>
: -
ObjAppDelegate = (AppDelegate *) [[UIApplication sharedApplication] делегат]; // создать объект AppDelegate
-(IBAction)ActionPushrightViewcontroller
{
rightViewcontroller *login = [[rightViewcontroller alloc]initWithNibName:@"rightViewcontroller" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:login];
_revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav];
[ObjAppDelegate.window setRootViewController:_revealSideViewController];
UIInterfaceOrientation interfaceOrientation = _revealSideViewController.interfaceOrientation;
NSString *subtypeDirection;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
subtypeDirection = kCATransitionFromTop;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
subtypeDirection = kCATransitionFromBottom;
}
else {
subtypeDirection = kCATransitionFromRight;
}
[ObjAppDelegate.window setRootViewController:_revealSideViewController];
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"];
}
и если вы хотите, чтобы поддержать вас домой использовать вид контроллера этот код: -
-(IBAction)ActionPopHomeviewcontroller
{
Homeviewcontroller *Home = [[Homeviewcontroller alloc]initWithNibName:@"Homeviewcontroller" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:Home];
UIInterfaceOrientation interfaceOrientation = viewController.interfaceOrientation;
NSString *subtypeDirection;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
subtypeDirection = kCATransitionFromTop;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
subtypeDirection = kCATransitionFromBottom;
}
else {
subtypeDirection = kCATransitionFromLeft;
}
[ObjAppDelegate.window setRootViewController:nav];
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"];
}
Я попробовал ваше решение, но результат все равно тот же. – parilogic
@parilogic заключается в том, что вы добавляете два навигационных элемента управления один, пока вы пытаетесь добавить PPRevealSideViewController, и один из них запущен в rightviewcontroller. –
Я добавил код – parilogic