 |
 |
|
 |
10-05-2008, 10:38 PM
|
#1 (permalink)
|
|
New Member
Join Date: Oct 2008
Posts: 2
|
Drawing text on a UIView
I am using a UIView to create some graphs (pie charts and bar graphs), which is easy enough.
But now I want to add some labels to these graphs, which is where I am stuck.
CGContextShowTextAtPoint() (and all the stuff leading up to its call) doesn't seem to work (shows no text) and I read it is not the recommended way of doing things anyway.
What is the recommended way of doing this and can someone point me to some examples?
Cheers,
Bas.
|
|
|
10-06-2008, 05:14 PM
|
#2 (permalink)
|
|
Registered Member
Join Date: Jul 2008
Posts: 16
|
Cant you just use a normal UILabel and add it to the view as a subview?
Code:
UILabel *newlabel=@"text here";
[existingView addSubView:newlabel];
|
|
|
10-06-2008, 05:54 PM
|
#3 (permalink)
|
|
New Member
Join Date: Sep 2008
Posts: 1,431
|
|
|
|
10-06-2008, 06:48 PM
|
#4 (permalink)
|
|
New Member
Join Date: Oct 2008
Posts: 2
|
Guys, thanks for the replies. I did find the trails in the sand code using google, but as that was doing pretty much the same thing as the example in the Apple docs I didn't try it verbatim. I should have as the reason the Apple code wasn't working was because the iPhone doesn't have the font they were using ("Times-Bold") - change it to helvetica and my code just worked. How frustrating! SelectFont doesn't have a return status to tell you it can't find the find nor does it crap out...
I'll try the UILabel thing a go as well, it could be friendlier to use than Quartz text.
Cheers,
Bas.
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 481 |
| 36 members and 445 guests |
| al31, AlanD, alexanderlonsky, andrei_c, atmel, AXP, bensj, BustinStones, CHV, Corsu, dany88, davidloew, DorkyMohr, dre, gate491, ggalante, iseff, issya, japaternoster, jingledale, jorgmart, KennyChong, Kryckter, listingboat, lukeca, macstar, MacSteve85, mebarron, mlo, moe, Mr Jack, RegularKid, Slecorne, Stephane.tamis, supudo, zmarco |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,493
Threads: 35,775
Posts: 156,709
Top Poster: smasher (2,448)
|
| Welcome to our newest member, AlanD |
|