8

पर SWRevealViewController लागू करें I स्टोरीबोर्ड के माध्यम से UITabbarController के साथ SWRevealViewController को लागू करता हूं। मैं केवल पहले UITabBarItem में SWRevealViewController को प्रदर्शित करना चाहता हूं, अन्य UITabBarItem में मैं SWRevealViewController को खोलना नहीं चाहता, जो पूरी तरह से किया गया। लेकिन यूआईटीएबीबार की समस्या दृश्य नियंत्रक की तरह नहीं बदली है जबकि SWRevealViewController दिखाई देता है।केवल एक UITabBarItem

कृपया मेरी मदद करें।

enter image description here

स्टोरीबोर्ड संरचना enter image description here

+0

आपको अपने एप्लिकेशन में UIContainerViewController उपयोग कर सकते हैं। Https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html और एक उदाहरण http://www.thinkandbuild.it/working-with-custom-container-view- पर अधिक जानकारी मिल सकती है। नियंत्रक/ –

+0

@Gagan_iOS मैं समझ नहीं पा रहा हूं कि कैसे उपयोग करें। कृपया विस्तार से बताएं। –

+0

ठीक है, आप UITabBarController का उपयोग कर रहे हैं और प्रत्येक टैब में UIViewController होगा। इसलिए आपको किसी विशेष टैब के UIViewController पर UIContainerView जोड़ना होगा। जैसा चाहें जोड़ने के लिए यहां एक उदाहरण दिया गया है। http://mobileoop.com/how-to-use-container-view-controller आपको बस अपने कोड के UIViewController पर इस कोडिंग को लागू करना होगा। –

उत्तर

1

मैं UITabbar के परिवर्तन स्थिति मैन्युअल SWRevealViewController प्रतिनिधि विधि का उपयोग कर समस्या का समाधान। इस कोड को 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); 
} 
संबंधित मुद्दे