Re: Number formatting
Re: Number formatting
- Subject: Re: Number formatting
- From: John MacMullin <email@hidden>
- Date: Fri, 10 Oct 2003 18:18:11 -0700
I seem to have given the wrong impression. The working code that I
listed works just fine. I just tried a number of things for my own
experimentation and education that resulted in memory and other errors.
For instance, if one does not perform a [[textView
removeFromSuperview]release]; but rather just [textView release], the
program runs but on the third iteration or through the code it just
stops and you get the spinning ball. I also tried an accessor method
on the textstorage with a init to try to "reuse" the variable but
discovered that the attributed strings did not seem to be getting
initialized. Again, the program runs but on the third iteration or so
the log starts showing errors. I also tried different variations of
autorelease/release on the essential variables, ie., textstorage with
differing results. The main result of this experimentation is to
conclude that the apple documentation seems to provide the best
approach (
file:///Developer/Documentation/Cocoa/TasksAndConcepts/
ProgrammingTopics/TextArchitecture/index.html ). Please note that I
haven't given up on some of these ideas. It would seem that they should
work.
In any event, I did not want to imply that something else was wrong. I
do apologize if I left that impression.
John
On Friday, October 10, 2003, at 05:42 PM, j o a r wrote:
>
>
On 2003-10-11, at 00.25, John MacMullin wrote:
>
>
> I did try a couple of other variations and the program "kabooms".
>
>
Where is it crashing? How is it crashing? Use the run log and debugger
>
to find out!
>
>
> fileFieldFourNumber = [fileFieldFourNumber
>
> stringByAppendingString:[numberFormatter stringForObjectValue:
>
> [[[self testFile] objectAtIndex: i] objectAtIndex:
>
> fieldFourNumberDef]]];
>
>
Replace the line of code above with something like this (temporary, to
>
track problems):
>
>
NSArray *arr1 = [self testFile];
>
NSLog(@"arr1 count: %d, i: %d", [arr1 count], i);
>
NSArray *arr2 = [arr1 objectAtIndex: i];
>
NSLog(@"arr2 count: %d, fieldFourNumberDef: %d", [arr2 count],
>
fieldFourNumberDef);
>
id obj = [arr2 objectAtIndex: fieldFourNumberDef];
>
NSLog(@"obj: %@, fileFieldFourNumber: %@", obj, fileFieldFourNumber);
>
NSString *formattedString = [numberFormatter stringForObjectValue:
>
obj];
>
NSLog(@"formattedString: %@", formattedString);
>
fileFieldFourNumber = [fileFieldFourNumber stringByAppendingString:
>
formattedString];
>
NSLog(@"fileFieldFourNumber: %@", fileFieldFourNumber);
>
>
Do you see anything suspicious from the logs that are printed?
>
>
> Given the degree of help that I have had with the text architecture I
>
> would be happy to donate the code.
>
>
Donate crashing code? :)
>
>
j o a r
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.