• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can I be so wrong about graphics?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I be so wrong about graphics?


  • Subject: Re: How can I be so wrong about graphics?
  • From: Evadne Wu <email@hidden>
  • Date: Tue, 07 Jun 2011 08:07:43 +0800

Something along the line of [self convertPoint:aPoint fromView:nil] should do the trick, if you’re very sure that the points were global.  Hope it helps.

-ev

On Jun 7, 2011, at 05:51, Development wrote:

> Hmm... it looks like it does draw the line... way off in the ether somewhere...
> I think I drew in the global coord system not the local to the view
>
> On Jun 6, 2011, at 2:37 PM, David Duncan wrote:
>
>> On Jun 6, 2011, at 2:31 PM, Development wrote:
>>
>>> I'm really loosing faith in my ability to read simple english
>>>
>>>
>>> According to like a million examples... If I place the follow bit of code in a view's drawRect: method I should get a line from pointA to pointB however I get nothing.
>>> How can subclassing UIView be this difficult? I have turned off clips to bounds, set the stroke color to black and done basically everything I know to do but I get an empty path
>>>
>>>
>>>  CGContextRef context    = UIGraphicsGetCurrentContext();
>>>
>>>  CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
>>>  CGContextBeginPath(context);//According to most examples this is a waste of code
>>>
>>>  // Draw them with a 2.0 stroke width so they are a bit more visible.
>>>  CGContextSetLineWidth(context, 2.0);
>>>
>>>  CGContextMoveToPoint(context, pointA.x,pointA.y); //start at this point
>>>
>>>  CGContextAddLineToPoint(context,pointB.x, pointB.y); //draw to this point
>>>
>>>  // and now draw the Path!
>>>  CGContextStrokePath(context);
>>
>>
>> What is pointA & pointB? What is self.strokeColor? Assuming this is happening within -drawRect:, it should work just fine.
>> --
>> David Duncan
>>
>
> _______________________________________________
>
> 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

_______________________________________________

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

References: 
 >How can I be so wrong about graphics? (From: Development <email@hidden>)
 >Re: How can I be so wrong about graphics? (From: David Duncan <email@hidden>)
 >Re: How can I be so wrong about graphics? (From: Development <email@hidden>)

  • Prev by Date: Re: Handling mouse events on transparent window conditionally
  • Next by Date: Re: How can I be so wrong about graphics?
  • Previous by thread: Re: How can I be so wrong about graphics?
  • Next by thread: Re: How can I be so wrong about graphics?
  • Index(es):
    • Date
    • Thread