Re: UIBezierPath: trying to create an array with CGPointMake
Re: UIBezierPath: trying to create an array with CGPointMake
- Subject: Re: UIBezierPath: trying to create an array with CGPointMake
- From: Fritz Anderson <email@hidden>
- Date: Mon, 20 Dec 2010 09:58:28 -0600
On 20 Dec 2010, at 1:20 AM, colo wrote:
> I'm in the processing of trying to create an array of Path points to
> draw a UIBezierPath CGRectMake onto each control point.
>
> Right now I am getting an error of
> error: void value not ignored as it ought to be
…
> - (IBAction)resetControlPoints:(id)sender
> {
>
> UIBezierPath *path = [UIBezierPath bezierPath]; {
> [path moveToPoint:CGPointMake(0,0)];
> return path;
> }
> points[0] = [path moveToPoint:CGPointMake(30, 70)];
> points[1] = [path moveToPoint:CGPointMake(30, 70)];
> points[2] = [path moveToPoint:CGPointMake(30, 70)];
> points[3] = [path moveToPoint:CGPointMake(30, 70)];
>
> }
Look at the documentation for -[UIBezierPath moveToPoint:]. The method returns void, but you're trying to assign the (nonexistent) result to members of the points[] array. You ought to be ignoring the void value, and aren't, just as the error message says.
You're returning path immediately after initializing it. Your assignments to points[] won't get executed anyway.
You're attempting to return path from a void method (IBAction methods return void). Attempting to return a value from a void method is at least a warning. Never ignore warnings.
Given that you can't return anything from an IBAction — nothing will receive the returned value — what do you expect to happen to path? In the method you show, it gets allocated, autoreleased, initialized, and thrown away.
Assuming you mean to use the four {30,70} points you refer to, (points[0] = CGPointMake(30, 70);), why do you think it necessary to reset the current point to that location?
If you do mean to reset the current point, why do it four times?
Assuming you don't mean the early return, why initially set the current point to {0,0} if you're just going to reset it?
And why are you enclosing those two lines in braces?
— F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden