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 10-05-2008, 10:38 PM   #1 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 2
Default 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.
baswell is offline   Reply With Quote
Old 10-06-2008, 05:14 PM   #2 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 16
Default

Cant you just use a normal UILabel and add it to the view as a subview?

Code:
UILabel *newlabel=@"text here";
[existingView addSubView:newlabel];
Pyrofer is offline   Reply With Quote
Old 10-06-2008, 05:54 PM   #3 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 1,431
Default

This link has a bit of code for drawing text

Exploring iPhone Graphics Part 1 | Trails in the Sand
PhoneyDeveloper is offline   Reply With Quote
Old 10-06-2008, 06:48 PM   #4 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 2
Default

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.
baswell is offline   Reply With Quote
Reply

Bookmarks

Tags
text, uiview

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: 438
13 members and 425 guests
AppleSteve, chiataytuday, Dav23Id, DaveDee, Domele, HowEver, ilmman, Jameswhitfield, LEARN2MAKE, rajeshkumar.y, shiv@globussoft.com, sudama, Tauseef
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 157,856
Threads: 88,915
Posts: 379,298
Top Poster: BrianSlick (7,072)
Welcome to our newest member, Tauseef
Powered by vBadvanced CMPS v3.1.0

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