Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > [object class]

[object class]
Thread Tools
Grizzled Veteran
Join Date: Aug 2005
Location: fairbanks AK
Status: Offline
Reply With Quote
Aug 29, 2005, 06:39 PM
 
i am working on an NSFormatter subclass that can handle a number of my classes. i have a mutable array that holds three types of data: vector, lineation and plane. plane extends lineation and lineation extends vector, however when i iterate through the array calling [object class] always returns vector, even if it is a lineation or plane. any ideas on why this is happening?

calling [object description] returns the format for vector string as well.

thanks,
Earth First! we'll mine the other planets later.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 29, 2005, 07:03 PM
 
Post your code. It sounds like you're doing something wrong, and you'll be pretty lucky if somebody just happens to guess what it is.
(Last edited by Chuckit; Aug 29, 2005 at 07:13 PM. )
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Grizzled Veteran
Join Date: Aug 2005
Location: fairbanks AK
Status: Offline
Reply With Quote
Aug 29, 2005, 07:24 PM
 
ugh, my mac is not networked (on a PC now) so posting the code is not possible, but here is some more info.

VectorFormatter basically takes and makes Vectors with i, j, k variables that have the form "<i j k>". OrientationFormatter extends VectorFormatter and should format planes and lineations (which extend vector) differently.

Code:
-(NSString *)stringForObject:(id)object { NSLog(@"class %@", [object class]); if([object isKindOfClass:[AKLineation class]]) { retirn [object description]; // if lineation } else { NSLog(@"defaulting on %@",[object description]); return [super stringForObjectValue:object]; } return [NSString stringWithFormat:@"error"]; }
when i start the program i have 10 instances of vector, plane and orientation added to the mutable array and the output always says
Code:
class Vector defaulting on <3 4 5> class Vector defaulting on <1 2 9> ...
i have the array bound to an array controller with default class Lineation and when i add a new one, it uses the vector notation, not the required format.

i have -(NSString *)description over-ridden in each class and i call each one in the init, and the display is fine, only when it is being displayed in the tableview does it default to vector notation.
Earth First! we'll mine the other planets later.
     
Grizzled Veteran
Join Date: Aug 2005
Location: fairbanks AK
Status: Offline
Reply With Quote
Aug 29, 2005, 09:06 PM
 
found the problem.

basically i had to find a way to display the model data "<3 0 4>" and the length "5" in the same tableview and hacked a way to send a copy of the model data to the transformer and then the length to the second column. had to create a new Vector (the one being displayed) to send to the object while the model didn't change. this was the vector that was being seen by the transformer. i've changed it so it works for each subclass and returns a copy of each subclass.

any way to use bindings to send a "self" key to get a copy of the model data?
Earth First! we'll mine the other planets later.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:27 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2