Hi,
I just went through some of the examples in the Aaron's book. I am now by chapter 15 but I realized that I still have some strange problems with the NSNumberFormatter, I thought it has been solved earlier.
For those of you who went through the book it is enough to say that the problem is with the percent formatted column of the RaiseMan tableView.
The second column contains the pay raise percentage representation. I did formatted it to "percent". It look like not a big deal but it behaves strangely.
1. When I start the application and press "Add New Employee", en object entry is created with default name, one can now write a specific name, then the percentage rate is filled by the default value that is specified in the init part of the Person class. in my case it is like this:
So one can see the 5,0 in the filed. and all seems fine.
2. When I add a second person and do change its expectedRaise to anything, lets say to 2%, then the first persons expectedRaise will change to 500% but in the code/logger there is still correct value 5%. The second person's expectedRaise is logged as 0,02.
3. When I save the file and open it again the first person's expectedRaise is 5% while the second person's expectedRaise is 0,02%
4. When I add a new person and start editing the expectedRaise value then all the values will be again changed, multiplied by 100.
I do not know what is happening. Seems like there is a multiply or divide 100 factor somewhere.
if I do not change the default expectedRaise values even if I add lots of persons the displayed value is correct. But if I even change a single value all the values displayed are multiplied by hundred.
I changed the formatter to "decimal" and there are no such a problems at all.
I even tried with currency, and it works fine there too even if it looks stupid.
I will appreciate some ideas that may help to catch the problem.
Best regards
/petron
I just went through some of the examples in the Aaron's book. I am now by chapter 15 but I realized that I still have some strange problems with the NSNumberFormatter, I thought it has been solved earlier.
For those of you who went through the book it is enough to say that the problem is with the percent formatted column of the RaiseMan tableView.
The second column contains the pay raise percentage representation. I did formatted it to "percent". It look like not a big deal but it behaves strangely.
1. When I start the application and press "Add New Employee", en object entry is created with default name, one can now write a specific name, then the percentage rate is filled by the default value that is specified in the init part of the Person class. in my case it is like this:
Code:
- (id)init {
[super init];
expectedRaise = 5.0;
personName = @"New person";
return self;
}
So one can see the 5,0 in the filed. and all seems fine.
2. When I add a second person and do change its expectedRaise to anything, lets say to 2%, then the first persons expectedRaise will change to 500% but in the code/logger there is still correct value 5%. The second person's expectedRaise is logged as 0,02.
3. When I save the file and open it again the first person's expectedRaise is 5% while the second person's expectedRaise is 0,02%
4. When I add a new person and start editing the expectedRaise value then all the values will be again changed, multiplied by 100.
I do not know what is happening. Seems like there is a multiply or divide 100 factor somewhere.
if I do not change the default expectedRaise values even if I add lots of persons the displayed value is correct. But if I even change a single value all the values displayed are multiplied by hundred.
I changed the formatter to "decimal" and there are no such a problems at all.
I even tried with currency, and it works fine there too even if it looks stupid.
I will appreciate some ideas that may help to catch the problem.
Best regards
/petron