Simple issue with basic iPhone application.

I have a simple app that I am trying to get functioning properly. The app will launch and run in the simulator and quit before I can see anything. I have made my Label Connection between the File Owner and the label by selecting the label on my background, selecting Connections Inspector in the Tools menu and then dragging from the plus sign under 'New Referencing Outlet' to the 'File Owner'. Once done I selected my label and this is the result. any idea how to fix this so the app will run now?

iPhone, iPhone OS 3.1.2

Posted on Jan 28, 2010 1:01 PM

Reply
19 replies

Feb 1, 2010 8:11 PM in response to kneedragger101

I don't even know what code file I put this code in or how I call it. It appears that my CountDownViewController.m file has most of the real work in it.

I have the following code that assigns the font to use for my countdownLabel... Would I place this code inside this method?


-(void)viewDidLoad {

[countdownLabel setFont:[UIFont fontWithName:@"Helvetica" size:64.0]];
countdownLabel.text = @"I0A0IN6";
[super viewDidLoad];
}

Feb 1, 2010 10:26 PM in response to kneedragger101

kneedragger101 wrote:
So I have seen this code over at Stack Overflow to add a custom font to my application. I'm not concerned with using this for distribution I just want to know how to do it...


I wouldn't use the code you posted: it uses a private API. So even if you did work out licensing issues with the fonts, you'd still be prevented from releasing it via the App store, since private APIs aren't allowed. If you're really dead set on this, look at this application that's linked from the same page:

http://github.com/zynga/FontLabel

It's by a game company that has at least one game on the App Store, so I suspect it doesn't use private APIs. That way you'd at least be learning something useful. But be aware that it's also a lot more complex.

Honestly, for what you're doing, which is just a clock, I'd skip the whole bit about loading a custom font and just make 11 bitmaps (0-9 and ":") in whatever font I wanted to use, at the size I wanted, and draw them into a UIView. That's a whole lot simpler than what you're trying to do.

And if the goal is to eventually use a custom font for much more of the interface, I'd suggest looking at the application I linked to in this post, since you'd at least be learning something useful that you could release.

And give some thought to what K T posted when he suggested that scale back a bit and work on something a little less ambitious for the time being. Then, once you get a better handle on where to put your code, how to debug, things like that, you can move on to something more complex.

For example, the code you just posted looks like it will list all the fonts on the iPhone in the console output:

NSLog(@"Available Font Families: %@", [UIFont familyNames]);


So try that and then see what happens if you change your font to one of the fonts listed there.

charlie

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Simple issue with basic iPhone application.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.