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: colo <email@hidden>
- Date: Mon, 20 Dec 2010 11:23:22 -0500
> 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
Because i'm really stupid. :P I'm truly hacking away trying to
translate the following method of code into iOS specific code to run
on the ipad. I'm still totally in a learning stage, cram a widget into
a socket and see if it works. No real good arguments for the way I am
trying this, but I can't seem to find a translation list for
converting methods of NSRect => CGRect => iOS UIBezierPath.
I thank you for the heads up on the Void issue. My fault. What I was
trying to find was a replacement for NSMakePoint, I saw the naming
scheme CGPointMake but could not get it to give me a decent compile
without using CGPointMake in some type of attribute of UIBezierPath
hence the moveToPoint, I thought there might be a createPointAt but
don't see anything like that.
Previous Cocoa code
- (IBAction)resetControlPoints:(id)sender
{
NSRect bounds = [self bounds];
points[0] = NSMakePoint(0.25 * bounds.size.width, 0.25 * bounds.size.height);
points[1] = NSMakePoint(0.25 * bounds.size.width, 0.75 * bounds.size.height);
points[2] = NSMakePoint(0.75 * bounds.size.width, 0.75 * bounds.size.height);
points[3] = NSMakePoint(0.75 * bounds.size.width, 0.25 * bounds.size.height);
[self setNeedsDisplay:YES];
}
_______________________________________________
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