Warum wird UILabel nicht initialisiert?
Der Code stammt von Stanford CS193p. Ich habe ein NSLog hinzugefügt, um es zu überprüfen. Das Label scheint nicht initialisiert zu werden. Irgendeine Idee?
@interface AskerViewController() <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UILabel *questionLabel;
@property (weak, nonatomic) NSString *question;
@end
@implementation AskerViewController
@synthesize questionLabel = _questionLabel;
@synthesize question = _question;
- (void)setQuestion:(NSString *)question
{
_question = question;
self.questionLabel.text = question;
NSLog(@"label is %@", self.questionLabel);
}
@end
Das NSLog-Ergebnis ist:
2012-07-31 01:56:45.177 Kitchen Sink[23931:f803] label is (null)