Setting a ViewController's properties after instantiation
Posted
by Craig
on Stack Overflow
See other posts from Stack Overflow
or by Craig
Published on 2009-04-15T03:43:37Z
Indexed on
2010/06/01
11:13 UTC
Read the original article
Hit count: 195
objective-c
|properties
I'm creating an instance of a viewController, and then trying to set the text on of it's properties, a UILabel.
BoyController *boyViewController = [[BoyController alloc] initWithNibName:@"BoyView" bundle:nil];
NSString *newText = [astrology getSignWithMonth:month withDay:day];
boyViewController.sign.text = newText;
NSLog(@" the boyviewcontroller.sign.text is now set to: %@", boyViewController.sign.text);
[newText release];
I tried this, but it didn't work...
So I tried the following:
BoyController *boyViewController = [[BoyController alloc] initWithNibName:@"BoyView" bundle:nil];
UILabel *newUILabel = [[UILabel alloc] init];
newUILabel.text = [astrology getSignWithMonth:month withDay:day];
boyViewController.sign = newUILabel;
NSLog(@" the boyviewcontroller.sign.text is now set to: %@", newUILabel.text);
[newUILabel release];
But no avail..
I'm not sure why I can't set the text property of the UILabel "sign" in boyViewController..
© Stack Overflow or respective owner