Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-05-2010, 07:04 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 5
Default How do i draw 2 lines with different stroke colors?

Hi!
I'm having a small problem with my graph drawing.

I can draw both 1, 2 and 3 line graphs simultaneously, but when i change the stroke color for one of the graphs, all my lines change color!

So my question is basically: How do i draw 2 lines with different stroke colors?

All the best - Chris!
davidgilmour is offline   Reply With Quote
Old 01-05-2010, 03:31 PM   #2 (permalink)
Developer & Translator
 
Kroupy's Avatar
 
Join Date: Dec 2008
Posts: 264
Default

I'm not quite sure, but when do you change the color? It sounds obvious, but try changing it just before you draw the line. That means change the color three times. Or are all three lines always colored like the last color?
Kroupy is offline   Reply With Quote
Old 01-05-2010, 03:41 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 5
Default

Quote:
Originally Posted by Kroupy View Post
I'm not quite sure, but when do you change the color? It sounds obvious, but try changing it just before you draw the line. That means change the color three times. Or are all three lines always colored like the last color?
Yeah, well that goes without saying but as you mention, all lines get the last stroke color I set.

I found this post and it helped me figure this one out:
Changing colors with CGContextStrokePath - Stack Overflow

You have to end your contentstrokepath, as if you're saying that "this line ends here", before you can call your new line a separate line :-)

Problem solved - thanks for your reply!
davidgilmour is offline   Reply With Quote
Reply

Bookmarks

Tags
drawing, line graph, quartz, stroke color

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 266
20 members and 246 guests
ADY, AragornSG, Bertrand21, Dani77, Dattee, Duncan C, fkmtc, HDshot, HemiMG, iDifferent, JasonR, macquitzon216, mer10, prchn4christ, Promo Dispenser, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:13 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0