Re: NSArray usage question.
Re: NSArray usage question.
- Subject: Re: NSArray usage question.
- From: Thomas Davie <email@hidden>
- Date: Fri, 6 May 2005 21:32:28 +0100
I would do
int plistSize = plist->getNPolys();
int currentPlistEntry;
NSMutableArray *ptArray = [NSMutableArray arrayWithCapacity:plist-
>getNPolys()];
NSBezierPath *path = [NSBezierPath bezierPath];
for (currentPlistEntry = 0; currentPlistEntry < plistSize;
currentPlistEntry++)
{
[ptArray addObject:plist->getPoint(currentPlistEntry)];
}
[path appendBezierPathWithPoints:ptArray count:plistSize];
Bob
On May 6, 2005, at 8:24 PM, Brian O'Brien wrote:
Is this the correct way to build and use an NSArray?
NSPoint ptArray[plist->getNPolys()];
CPoint p;
for (i=0; i < plist->getNPolys(); ++i)
{
p = plist->getPoint(i);
ptArray[i].x = p.x;
ptArray[i].y = p.y;
}
NSArray *pts = [NSArray arrayWithObjects:ptArray count:i];
NSBezierPath *path = [NSBezierPath bezierPath];
[path appendBezierPathWithPoints:pts count:i];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden