2013-09-25 5 views
0

В моем приложении я использую PPRevealSlideViewController.SlideView, начинающийся под навигационной панелью в PPRevealSlideViewController

Проблема: правый вид сбоку приближается к навигационной панели, как показано красным овалом на изображении. Это не начинается с крайнего верха. Каким будет исправление?

Bothe левый и правый боковой видКонтроллеры имеют навигациюBar.

Код:

MainController главная = [[MainController Alloc] initWithNibName: @ "MainController" пачке: ноль];

UINavigationController *navMainController = [[UINavigationController alloc] initWithRootViewController:main]; 

PPRevealSideViewController *revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:navMainController]; 

revealSideViewController.delegate = main; 

[self.navController pushViewController:revealSideViewController animated:YES]; 

[main release]; 

enter image description here

ответ

1

вам нужно 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"]; 


} 
+0

Я попробовал ваше решение, но результат все равно тот же. – parilogic

+0

@parilogic заключается в том, что вы добавляете два навигационных элемента управления один, пока вы пытаетесь добавить PPRevealSideViewController, и один из них запущен в rightviewcontroller. –

+0

Я добавил код – parilogic

Смежные вопросы