My question is slightly different then my title suggest. I have worked with xib. Now i am trying to work with storyboard. My question is if we are navigate through one class from another class, is StoryBoard giving benefit for better memory management. Suppose we have 2 ViewControllers: ViewControllerA and ViewControllerB. We are trying to go through ViewControllerA --> ViewControllerB. Now, in Xib our approach is below;
ViewControllerB *VCB = [ [ViewControllerB alloc] init];
[self.navigationController pushViewController: VCB Animated: YES];
Where in Story Board,
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"Second"])
{
SecondViewController *objSecond = (SecondViewController*)[segue destinationViewController];
}
}
And Do,
[self performSegueWithIdentifier:@"Second" sender:self];
So, My question is We alloc our class in Xib, Where in storyBoard we aren't. So is there any memory allocation advantages in storyboard?
It is not to tell which one is the best. because which one is good to tell based on team requirement.
If you are a single developer, it is good to use storyboard because it consumes less time. If the team consists of many developers, use xib, otherwise, it is not easy to merge the modules/tasks.
xcode-using-storyboards-and-xibs-versus-creating-views-programmatically
Advantages:
You can quickly put together a UI
Straight-forward implementation for small apps with a minimal number of screens
You can have separate XIBs for different localizations (ie. languages or countries)
Great at laying out elements and visually spotting misalignments. It’s easy to make a slight adjustment to the layout
Disadvantages:
It’s difficult to merge conflicts when working in a team environment (hard to diff, merge and read)
Highly dynamic views are impossible to describe as a XIB
Performance wise, it’s slower than creating views through code because the xib needs to be read from the disk and analysed/parsed
XIBs lack customizations that you can do in code such as Quartz stuff (drop shadows, round corners)
Harder to debug (i.e. if you forget to make a connection in Interface Builder or make a wrong connection)
Advantages:
Storyboards are nice for apps with a small to medium amount of screens and the requirements for navigation is relatively straightforward between views
You can mock up the flow of an application without writing much, if any, code
Disadvantages:
Storyboards are not compatible with pre-iOS 5 so it makes supporting iOS 4.3 impossible
It’s hard to work in parallel in a team environment because everyone’s modifying the same file
Along the same lines, merging conflicted storyboards in GIT will be a pain
People have experienced bugs in Xcode with the usage of storyboards (eg. having to frequently flush the DerivedData folder because of inconsistencies)