Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

INTERFACE

Can you use storyboard and using the coding method for UI in the the same app

1 Answer

Absolutely!

thanks but how would you make them work together?

Depends on what you are trying to accomplished, you can have a storyboard with a view and any number of elements you want, and then add a UILabel programmatically during viewDidLoad in your view controller as follow:

- (void)viewDidLoad
{
    [super viewDidLoad];

    UILabel * label = [[UILabel alloc] initWithFrame:(CGRect){{50,50},{29,100}}]; // size 29x100 with top-left origin at (50,50)
    label.text = @"This label is programmatically generated";
    [self.view addSubview:label];
}

As far as how to make them work together, it really depends on what you are trying to accomplish.

do you code the whole interface in the appDelegate ?