Sometimes, you may need to find out the class name of an object. A typical example is that when you want to check what is added to a UIView. Continue reading iPhone – Get Class Name
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
Story Smart – My First Approved iPhone App
Finally i got one iPhone Application approved by app store. Actually this is my second iPhone app. The first one is rejected by app store since i didn’t handle the missing camera issue in iPod Touch. Hopefully, i will resubmit the first one soon.
Continue reading Story Smart – My First Approved iPhone App
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 = 1… Continue reading iPhone – Wrap Text in UILabel
iPhone – Prevent iPhone Application From Sleeping
By default, there is an idle timer in iPhone such that it will go to sleep mode if it is idle for a period of time.
So if you don’t want your iPhone Application goes to sleep mode automatically, you can disable the idle timer by the following. Continue reading iPhone – Prevent iPhone Application From Sleeping
iPhone – Localizing iPhone Application Name
Yesterday we talked about how to localize the iPhone Application. For more details, please refer to iPhone – Localization. So how about the localizing the application name?
Continue reading iPhone – Localizing iPhone Application Name
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")];
iPhone – Best Audio Format
With AVAudioRecorder, we can create different audio files in different format. So how could we determine which format we should use?
Continue reading iPhone – Best Audio Format
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