Numeric var from a textfield
I've make a small project.
In this project i make a simple equations.
I don't know like declaring a numeric variable and assign to var a textField numeric value for execute the calculator.
A small sample are here:
//------ File .h
NSNumber *myNumber;
//------ File .m
- (void)viewDidLoad
{
//.. various var, ..etc.
myNumber = [[NSNumber alloc] init];
//
//myNumber = [[NSNumber alloc] initWithDouble:0];
[self myFunction]
}
-(void) myFunction{
myNumber = [NSNumber numberWithDouble:[myTextField.text doubleValue]];
float calcoloRisultato;
calc = myNumber/0.8;
// ERROR Calc.
}
----- If i make
double myNumber = [myTextField.text doubleValue];
All is OK
Where is the error?
How to solve this?
I want declare the myNumber var in all class and not only in a function.
Thanks for help me.
jj
|