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 08-12-2009, 04:13 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 24
Exclamation UITextView issue

I have a navigation-based application running on the 3.0 simulator on the SDK. Long story short, the program works, but I want to change the font settings on the UITextView that I have in my DetailViewController.

In the header file, I declare an IBOutlet UITextView *textSpace;
It is defined as a property, and synthesized in the .m file.
In IB, it is linked to the UITextView.

I know that the link is good, because I can control the textSpace's alpha settings from the DetailViewController.m file.

Anyways, the text in the UITextView is loaded from a text file, read into a string, and loaded into the field. The editable selection has been deselected, so it only displays the text.

When I try the code:

textSpace.font = [UIFont fontWithName:@"Arial"];

the program builds, but I get a warning

"warning: 'UIFont' may not respont to '+fontWithName:'
(Messages without a matching method signature will be assumed to return 'id' and acept '...' as arguments.)"

Additionaly, the program will now crash when it tries to load the DetailView.

Does anybody have suggestions for changing the format of the text? Ideally, I would like to get it to display with the 'Georgia' font.
mazraf is offline   Reply With Quote
Old 08-12-2009, 04:41 AM   #2 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
Send a message via AIM to kelvinkao
Default

I don't think there's a +fontWithName: method. There's a +fontWithName: size: method though. That means you need to provide both parameters instead of just one.
kelvinkao is offline   Reply With Quote
Old 08-12-2009, 05:09 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 24
Default

Quote:
Originally Posted by kelvinkao View Post
I don't think there's a +fontWithName: method. There's a +fontWithName: size: method though. That means you need to provide both parameters instead of just one.
I tried using

textSpace.font = [UIFont fontWithName:@"Georgia" ofSize:10.0f];

and I still got a warning and program crash.

Thanks for helping.
mazraf is offline   Reply With Quote
Old 08-12-2009, 05:39 AM   #4 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
Send a message via AIM to kelvinkao
Default

Remove 'of'.
kelvinkao is offline   Reply With Quote
Old 08-12-2009, 05:45 AM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 24
Default

textSpace.font = [UIFont fontWithName:@"Georgia" Size:10.0f];

had warning:
'UIFont' may not respond to '+fontWithName:Size:'

also crashed on the simulator.
mazraf is offline   Reply With Quote
Old 08-12-2009, 05:48 AM   #6 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
Send a message via AIM to kelvinkao
Default

'size', not 'Size'
When in doubt, look it up:
UIFont Class Reference
kelvinkao is offline   Reply With Quote
Old 08-12-2009, 05:59 AM   #7 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 24
Default

Thank you Kelvinkao. Works perfectly now.
mazraf is offline   Reply With Quote
Reply

Bookmarks

Tags
detail view, font, text, uitextview

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: 259
24 members and 235 guests
@sandris, ADY, Dani77, diyora, FAED, fredidf, F_Bryant, GHuebner, HDshot, iDifferent, JamesCahall, JasonR, mer10, Oral B, prchn4christ, Rudy, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,753
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

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