I am building an app using container views.
I have been browsing the internet to find examples on how to use it properly but, unfortunately, I found very few examples and, so far, none of them use storyboards the way I intend to do.
Here is a picture of my storyboard:
The code I wrote is this: (FirstWinViewController.m)
#import "FirstWinViewController.h"
#import "ContainerClassViewController.h"
@interface FirstWinViewController ()
@end
@implementation FirstWinViewController
- (IBAction)clickOne:(id)sender {
ContainerClassViewController *viewContained = [[self.childViewControllers[0] viewControllers] objectAtIndex:0];
[viewContained gotoSegue:1];
}
- (IBAction)clickTwo:(id)sender {
ContainerClassViewController *viewContained = [[self.childViewControllers[0] viewControllers] objectAtIndex:0];
[viewContained gotoSegue:2];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
(ContainerClassViewController.m)
#import "ContainerClassViewController.h"
@interface ContainerClassViewController ()
@end
@implementation ContainerClassViewController
-(void)gotoSegue:(int)umOuDois {
switch (umOuDois) {
case 1:
[self.navigationController popToRootViewControllerAnimated:NO];
[self performSegueWithIdentifier:@"seguePush1" sender:nil];
break;
case 2:
[self.navigationController popToRootViewControllerAnimated:NO];
[self performSegueWithIdentifier:@"seguePush2" sender:nil];
break;
default:
break;
}
}
It is working exactly the way I want. My questions are:
. Is it right according to Apple's rules?
. Is this approach using more memory, leaving trash or using more resources than the examples that create Container views by code and use AppDelegate to manage them?
Thanks in advance.