[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: my calculator has problems
From: |
Germán Arias |
Subject: |
Re: my calculator has problems |
Date: |
Sat, 09 Apr 2016 11:46:43 -0600 |
El sáb, 09-04-2016 a las 08:53 -0400, umen escribió:
> Hi,
> Number1 is NSButton. result is the NSTextField. I assign string to
> number1 because with strings I can append other numbers and assign
> this new number to number1 again, then I use doubleValue to get a
> double from this string. It's exactly what else{} is doing at all
> button methods. Or there is another/better way to do that not using
> strings?
>
Why number1 is an NSButton?
If you need an string, then use an NSString. But in that case, you can't
call -setDoubleValue: (line 157 in UCalc.m), because class NSString
don't implement this method. You should do something like:
number1 = [NSString stringWithFormat: @"%f", [number2 doubleValue] +
[number1 doubleValue]]
Germán