Хорошо, обо всем по порядку, давайте удалим некоторые посторонние вещи и сосредоточимся на том, что вам нужно.
#import "CalculatorBrain.h"
@interface CalculatorViewController : UIViewController
{
CalculatorBrain* _calculatorModel;
UILabel *display;
}
- (IBAction) digitPressed:(UIButton *)sender;
@property (nonatomic, retain) IBOutlet UILabel *display;
@end
#import "CalculatorViewController.h"
@implementation CalculatorViewController
@synthesize display;
- (void)dealloc
{
[display release], display = nil;
[_calculatorModel release];
[super dealloc];
}
- (void)viewDidLoad
{
[super viewDidLoad];
if (! _calculatorModel)
{
_calculatorModel = [[CalculatorBrain alloc] init];
}
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSLog(@"display is: %@", display);
}
- (IBAction)digitPressed:(UIButton *)sender
{
NSString *currentDigit = [[sender titleLabel] text];
[display setText:[NSString stringWithFormat:@"%@", currentDigit]];
}
@end
Дайте нам знать, что произойдет, когда вы установите метку (display) и действие (digitPressed :) в InterfaceBuilder.