Exploring XIB and Storyboard Views

Many Xcode users create views and view controllers in Interface Builder (IB), using storyboards and XIB files rather than building them directly in code. The following snippet demonstrates how to use Recipe 4-1 to deconstruct views loaded from these resources:

UIView *sampleView = [[[NSBundle mainBundle]     loadNibNamed:@"Sample" owner:self options:NULL] objectAtIndex:0]; if (sampleView) {     NSMutableString *outstring = [NSMutableString string];     [self dumpView:sampleView atIndent:0 into:outstring];     NSLog(@"Dumping sample view: %@", outstring); } UIStoryboard *storyboard = [UIStoryboard     storyboardWithName:@"Sample" bundle:[NSBundle mainBundle]]; UIViewController *vc ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.