Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Apr 7, 2009, 08:21 AM   #1
macrumors 6502a
Join Date: Dec 2006
Location: Katy, Texas
Send a message via AIM to toddburch Send a message via MSN to toddburch
Where's the beef (where the code?)

I just made my first iPhone project. I wrote no code - just Xcode and IB. I dragged a label out, changed the text, set the text color and the background color and ran it. No big deal. Works great in the simulator.

Then, I thought I would change the font of the text. First let down. Apparently, there are only a certain number of fonts that can be used on the iPhone, and the one I wanted wasn't there. So, I tried using some on the list (I googled) that were there. Sometimes, I could see the font changing when I double-clicked the label to edit the text, but any time I clicked off the label, the font always reverted to the default font. I am, however, able to press CMD+I to add italics and CMD+B for bold text when editing the text.

Then I started looking at the generated code, with the mindset to set the font in code, but I could not find anywhere where the label's text was being set, or the text color or back ground color were being set.

I looked in these files:


I could not figure out how to view
as double clicking it just opened IB.

Where' the code?
toddburch is offline   0 Reply With Quote
Old Apr 7, 2009, 08:28 AM   #2
macrumors 6502a
Join Date: Mar 2008
Location: North Shore, MA
Originally Posted by toddburch View Post
Where' the code?
There isn't any. The xib is a serialized object graph, which is converted into a nib at compile time, which can then be loaded directly at runtime.
Make life easier if you have a programming question!

Last edited by Guiyon; Apr 7, 2009 at 08:39 AM.
Guiyon is offline   0 Reply With Quote
Old Apr 7, 2009, 09:12 AM   #3
macrumors newbie
Join Date: Jul 2002
To change the font of any text field, you'll need to click on the field in interface builder, then press command-T to bring up the fonts picker. Though remember to choose a font that actually exists on the iphone - there are lists around the web if you're not sure which ones they are. (There's also a handy "Fonts" app for the phone itself.)

But yes, the xib file itself is not hackable. To go further with customizing things, you'll need to create IBOutlets in your program to the elements you've set up in Interface Builder, like IBOutlet UILabel *mylabel; That gives you a handle (mylabel) for customizing the label object programmatically.
tsornin is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
My Beef with iOS--Basics still missing ericinboston iOS 5 and earlier 14 Feb 3, 2013 04:00 PM
I just sauteed some onions and corned beef, and then I thought.... PerplexShyt Wasteland 1 Sep 11, 2012 11:28 AM
What's been your biggest beef with 2012 MBAs? For me it's Magsafe 2... Jobsian MacBook Air 35 Jul 31, 2012 04:19 PM
I have a beef with Spotlight akadmon OS X 3 Jun 11, 2012 05:16 PM

Forum Jump

All times are GMT -5. The time now is 09:01 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC