Tag Archives: iPhone

iPod Touch – Check if Camera is Available

Previously my first iPhone Application was rejected by Apple App Store. That application has a feature which allow users to take a photo or select an existing photo in the gallery.

As iPod Touch does not have a camera, the application crashes when user decide to take a photo. That’s why App Store rejected it.

So i have to check if the camera of the device is available. The following piece of code can do. Continue reading iPod Touch – Check if Camera is Available

iPhone – Create an iAd Application

Starting from iPhone OS4, you can add an advertisement banner to your iPhone Application using the iAd framework. I found a great article talking about adding iAd to the iPhone app. Here is an example of a empty view based application with iAd.

1. Open Xcode and create a new View-based Application (iAdProject)
2. Add iAd.framework to the project
3. Modify the iAdProjectViewController.h Continue reading iPhone – Create an iAd Application

iPhone – Wrap Text in UILabel

In UILabel, there is an adjustsFontSizeToFitWidth property which will automatically adjust the text font size to fit the UILabel width.

UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 20.0)];
aLabel.adjustsFontSizetoWidth = YES; // This is a must
aLabel.minimumFontSize = 8.0f; 
aLabel.numberOfLines = 1; // This is a must too =.=

But this only work for numberOfLines = 1Continue reading iPhone – Wrap Text in UILabel

iPhone – Localization

Localization is a must in mobile application development. The article will shows you how to localize your iPhone Application in just a few steps.

1. Whenever you need a localized string in your application, use the NSLocalizedString(NSString *key, NSString *comment).

[self.label1 setText:NSLocalizedString(@"label1.text", @"Label1 in MyViewController.m")];
[self.label2 setText:NSLocalizedString(@"label2.text", @"Label2 in MyViewController.m")];
[self.label3 setText:NSLocalizedString(@"label3.text", @"Label3 in MyViewController.m")];

  Continue reading iPhone – Localization

iTunes – Create .caf File

The AVAudioRecorder creates .caf format file in my next iPhone Application. so what is .caf file?

Core Audio Format (.caf) is a audio file container developed by Apple for audio files. A .caf file can contains different audio file formats just like .mov container for different video formats.

The post shows you how to convert the following file extensions to .caf using iTunes. Continue reading iTunes – Create .caf File