Monday, 12 August 2013

Obj-C: Incompatible pointer types assigning to 'UITextfield *_strong' from 'NSNumber *_strong

Obj-C: Incompatible pointer types assigning to 'UITextfield *_strong' from
'NSNumber *_strong

Ok Ive looked at the other similar questions but I cant figure out why
NSNumber would not be compatible with the UIText Field.
my .h
@property (weak, nonatomic) IBOutlet UITextField *initialBudget;
@property (weak, nonatomic) IBOutlet UITextField *expenses;
@property (weak, nonatomic) IBOutlet UITextField *timeSpent;
@property (weak, nonatomic) IBOutlet UITextField *incomePerHour;
These is my calculations
- (IBAction)calculateResults:(id)sender {
double budget = [initialBudget.text doubleValue ];
double expense = [expenses.text doubleValue];
double time = [timeSpent.text doubleValue];
double hourlyIncome = (budget - expense)/time;
NSNumber *resultNumber = [[NSNumber alloc] initWithDouble:hourlyIncome];
incomePerHour = resultNumber;
}
any help would be great, thanks

No comments:

Post a Comment