I have an UIViewController in which I create an UILabel programmatically in its' viewDidLoad: like so:
- (void)viewDidLoad
{
UILabel *navTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(17, 0, 100, 100)];
navTitleLabel.backgroundColor = [UIColor clearColor];
navTitleLabel.textAlignment = NSTextAlignmentCenter;
navTitleLabel.textColor=[UIColor colorWithHexString:@"#000029"];
[navTitleLabel setFont:[UIFont fontWithName:@"Pennyscript" size:20]];
self.navigationItem.titleView = navTitleLabel;
}
I have the "User defined Runtime Attribute" set in the ViewController's identity inspector tab:
What I'm trying to do here is programmatically set the UILabel navTitleLabel's font to my custom font, then add that UILabel into the navigationBar's titleView. What am I doing wrong? How can I accomplish this goal?
With the UDKA(User defined key attribute) in the VC ID-inspector, the app crashes with this stack trace message:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key fontName.'
When I remove my User Defined Key Attribute from the ViewController, I can then navigate to the VC with no crash.

