You could create an array of objects grouping the parameters of your strings
For example:

typedef struct
{
    NSAttributedString    *text; // it already contains color and font
    NSPoint                     position;
} MyObj;

Or you can even create your own class MyObj
The you create the array containing a bunch of these objects MyObj

NSMutableArray  *mStrings = [[NSMutableArray array] retain];

for(i = 0; i < totStrings; i++){
    create the object MyObj
    set string, color and positions
    add to the array
    [mStrings addObject:anObj];
}

Then on the drawRect: method of your NSView you iterate through the array
mStrings and draw the strings with their parameters.

- (void)drawRect:(NSRect)rect
{
    [super drawRect:rect];

    for(anObj in mStrings ){
        [anObj.text drawAtPoint:anObj.position];
    }
}


Regards
-- Leonardo


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to