Я объявил UILabel
в моем контроллере вида
@interface ViewController : UIViewController
{
UILabel *statusText;
}
@property (nonatomic,retain) IBOutlet UILabel *statusText;
-(IBAction)buttonPressed:(id)sender;
@end
Теперь я хочу, чтобы заголовок UILabel
менялся при нажатии моей кнопки, но мой statusText
не может быть установленправильно.например:
- (IBAction)buttonPressed:(id)sender{
NSString *title = [sender titleForState:UIControlStateNormal];
NSString *newText = [[NSString alloc]initWithFormat:@"%@button pressed",title];
statusText.text = @"helloworld";
NSLog(@"%@",statusText.text);
[newText release];
}
журнал возвращает
2012-01-25 00:46:27.663 buttonfun[34247:f803] (null)
Это означает, что текстовое свойство "helloworld" не было установлено.Почему?