Hi All!
im new in objective C programming but i've read an excellent book by Steve.
well... my problem is that my frac calculator displays nothing. i was trying to find where is the problem can be and wrote little test program:
#import <UIKit/UIKit.h>
@interface SenderViewController : UIViewController {
UILabel *display1;
NSMutableString *aString;
}
@property(retain, nonatomic) IBOutlet UILabel *display1;
@property(retain, nonatomic) NSMutableString *aString;
-(IBAction)click1:(UIButton *) sender;
@end
#import "SenderViewController.h"
@implementation SenderViewController
@synthesize display1, aString;
-(IBAction)click1:(UIButton *) sender
{
[aString appendFormat:@"%i",sender.tag];
display1.text = aString;
}
- (void)dealloc
{
[display1 release];
[super dealloc];
}
@end
this prog have button, display and should return tag button on display... but nothing happens. it is a simple analog of two methods from exercise 21.2:
-(void) processDigit: (int) digit &
-(IBAction) clickDigit: (UIButton *) sendercan you give me some advices?!
i find my problem but dont know how to fix it. its all because
displayString = null all time
-(void) processDigit: (int) digit;
{
currentNumber = currentNumber * 10 + digit;
[displayString appendString: [NSString stringWithFormat: @"%i", digit]]; //cannot assign displayString here...
display.text = displayString;
}