Eric
Eric

Reputation: 4061

Interface Builder / Storyboard Properties read by code?

My questions is simple: Does the compiler recognize a property determined in Interface Builder in code?

Example: I give a UIViewController View a title of "Test Title" in IB and I want to say in code:

if ([self.title isEqualToString:@"Test Title"])
{
NSLog(@"Yes");
}

Will this work? I'm asking in part about this specific example, but also in general using other properties...

Upvotes: 0

Views: 99

Answers (2)

ilhan çetin
ilhan çetin

Reputation: 383

As Mundi has said you can do anything with code what you can with the IB. Also, in some situations you need to create or trigger some specific actions&results by code which you can't decide in IB. For example, if you want an new view with some buttons(and their actions, properties) be created about the response that comes from a server(which can't be known during coding/designing) coding is a great way instead of IB. Long story short, when you need dynamic results, coding is better, else IB(for storyboards too) easier

Upvotes: 2

Mundi
Mundi

Reputation: 80273

Yes. If you test it, you will find that it is true. You can do anything you can do in IB also in code.

Upvotes: 1

Related Questions