- First we'll need to reference the container that we've set up in the app delegate.
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
TAGContainer *container = appDelegate.container;
- Using stringForKey method of the container, we'll reference the key greetings from the value collection variable in our GTM container and update the text of the current greetingsText UILabel.
self.greetingsText.text = [container stringForKey:(@"greetings")];
- As a final step we retrieve the alignment and update the text alignment accordingly.
NSString *alignment = [container stringForKey:(@"greetings-alignment")];
if ( [alignment isEqualToString:@"left"])
self.greetingsText.textAlignment = NSTextAlignmentLeft;
else if([alignment isEqualToString:@"right"])
self.greetingsText.textAlignment = NSTextAlignmentRight;
else
self.greetingsText.textAlignment = NSTextAlignmentCenter;