8

Implementare SWRevealViewController con UITabbarController tramite storyboard. Voglio mostrare SWRevealViewController solo nel primo UITabBarItem, in altro UITabBarItem non voglio aprire SWRevealViewController, che è stato fatto completamente. Ma il problema è che la posizione di UITabBar non cambia come viewcontroller mentre appare SWRevealViewController.Implementare SWRevealViewController su un solo UITabBarItem

Per favore aiutatemi.

enter image description here

struttura Storyboard enter image description here

+0

È possibile utilizzare UIContainerViewController nella vostra app. Maggiori informazioni possono essere trovate su https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html e un esempio http://www.thinkandbuild.it/working-with-custom-container-view- controller/ –

+0

@Gagan_iOS non riesco a capire come utilizzare. per favore, elabora. –

+0

ok, stai usando UITabBarController e ogni scheda avrebbe un UIViewController. Quindi devi aggiungere UIContainerView su un UIViewController di una particolare scheda. Ecco un esempio per aggiungere come vuoi. http://mobileoop.com/how-to-use-container-view-controller Devi solo implementare questa codifica su UIViewController della tua scheda. –

risposta

1

I risolvere il problema posizione di cambio di UITabbar manualmente utilizzando SWRevealViewController metodo delegato. Inserire questo codice in MenuViewController.

MenuViewController.m

- (void) viewDidLoad { 
    [super viewDidLoad]; 

    UITabBarController *tbc = (UITabBarController *)[[[[UIApplication sharedApplication]delegate]window]rootViewController]; 
    self.tabBar = tbc.tabBar; 

    _tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height); 
    self.revealViewController.delegate = self; 
} 

- (void) revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position { 
    if (position == FrontViewPositionRight) { 
     _tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height); 
    } 
    else { 
     _tabBar.frame = CGRectMake(0, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height); 
    } 
} 

- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress { 
    _tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth * progress, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height); 
} 
Problemi correlati