xmartlabs / XLMailBoxContainer

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

Question: How to remove code from AppDelegate : nib and/or storyboard example #2

Closed wm-j-ray closed 9 years ago

wm-j-ray commented 10 years ago

Martin,

I'm trying to use this with storyboards and would like to get everything out of the AppDelegate.

Question: Do I have to use XLSwipeNavigationController? I thought I should be able to load up the view controllers and init but I can't get it working. I tried various iterations of this in a viewDidLoad and initWithNibName

 [self initializeViewControllers];
 XLSwipeContainerController * containerController = [[XLSwipeContainerController alloc] initWithViewControllers:_controllers];
  [self.navigationController pushViewController:containerController animated:YES];

Can you point me to more of a storyboard/nib example?

ronnyandre commented 10 years ago

+1

ccuenca commented 10 years ago

Hi, to use in Storyboard you can:

  1. Create a custom class from XLSwipeNavigationController
  2. Assign to a view in your storyboard
  3. 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

@ronnyandre @ronnyandre @ccuenca Now the master branch examples use storyboard.

Regards