xmartlabs / XLMailBoxContainer

Custom container view controller ala MailBox app.
MIT License
89 stars 15 forks source link

How to use XLMainboxContainer in TabBar #1

Closed jacksun1203 closed 9 years ago

jacksun1203 commented 10 years ago

Hi,

I am trying to integrate this XLMailBoxContainer into my iOS App. The APP uses Tabbar controller. And I would like to put this XLMainboxContainer in on of the tab (call tab A). And there are two table views in tab A, and those tow table views switch by clicking the segment controller. I think this package is quite fit to my need. But I am not sure how to integrate it with tab bar controller. Could you give me some hint or example? Thanks!

jacksun1203 commented 10 years ago

I just figured it out, but not sure it's a good solution though. Please advise.

// ………….. MainTabBarViewController tabbarController = segue.destinationViewController; DirectReferralViewController directSegment = [self.storyboard instantiateViewControllerWithIdentifier:@"DirectReferralViewCtrl"];

IndirectReferralViewController *indirectSegment = [self.storyboard instantiateViewControllerWithIdentifier:@"IndirectReferralViewCtrl"];

NSArray * childViewControllers = @[directSegment, indirectSegment];

XLSwipeContainerController * containerController = [[XLSwipeContainerController alloc] initWithViewControllers:childViewControllers];

    [[tabbarController.viewControllers objectAtIndex:3] initWithRootViewController:containerController];

// ---------------------------------------------

The last line got an waring message, "Express result unused". Maybe you have better idea to assign the containerController to one of tab of tab bar controller.

thanks for this great package.

ccuenca commented 10 years ago

Hi

i use this in a Storyboard,

  1. From tabController put a segue to a view and
  2. Create a custom class from XLSwipeNavigationController
  3. Assign to a view in your storyboard
  4. Override the default init method

-(id)initWithCoder:(NSCoder )aDecoder { self = [super initWithCoder:aDecoder]; if (self) { // Custom initialization // create child view controllers that will be managed by XLSwipeContainerController TestViewController * child_1 = [[TestViewController alloc] initWithStyle:UITableViewStylePlain]; TestViewController * child_2 = [[TestViewController alloc] initWithStyle:UITableViewStylePlain]; TestViewController * child_3 = [[TestViewController alloc] initWithStyle:UITableViewStylePlain]; TestViewController \ child_4 = [[TestViewController alloc] initWithStyle:UITableViewStylePlain]; self = [self initWithViewControllers:child_1, child_2, child_3, child_4, nil]; } return self; }

mtnbarreto commented 10 years ago

@jacksun1203 @ccuenca take a look master branch example.

Regards.