Archive for the Category »iPhone «

iPhone localization

Quick way to find current language .

NSString   *language = [[NSLocale currentLocale] objectForKey: NSLocaleLanguageCode];
NSString   *countryCode = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode];

Got it from Stackoverflow Putting it here for reference.

Restore to production iPhone software image

Downloaded and installed ios4.1 beta about 2 weeks ago.  Tried it out with the beta Xcode.  Sad to find out this wreck my testing and deployment for production code.

Did a search and found ways to restore iPhone to another image.  Followed the instructions and reset my deployment target to ios4.0.2.  Everything works out except for my iPhone backups and settings.  Need to sort out that but it’s minor.

http://www.demonoid.com/files/details/2271749/009063673263/

http://www.iclarified.com/entry/index.php?enid=750

Thanks to the good guys at iClarified who maintained the list of previous iPhone firmware file.

using iOS4 with iPhone 3G

no multi-tasking! also heard that iOS4 takes up lots of memory. no wonder, my app is facing problem. really need to optimize the app in terms of memory access and usage.

Google Maps will be with iPhone / iPad for long time

As quoted by Steve Jobs in recent All Things D Conference near Los Angeles, “The iPhone would continue to have Google Maps”

Therefore, good to continue using Google Maps API with iPhone’s Mapkit.

First look at iPhone 3.2 SDK

iPhone 3.2 works for both iPad and iPhone platform.  The iPad simulator is damn small within my Macbook display.  Guess it’s part of Apple’s plan to encourage me to get a larger MacBook or a 20″+ display.

Quick look at the SDK shows some new APIs for displaying on iPad.  With the larger screen estate, much more effort on designing the work areas.  Need to read the updated UI guidelines for iPad.

Category: Xcode, iPad  Leave a Comment

iPhone OS 3.2 downloaded & installed

Even though iPhone OS 4.0 beta 3 just release, I myself not in a habit to using beta.  Been using 3.1 for quite some time and getting used to it.

Like the static analyzer and now it compiles faster than before.  Using LLVM GCC4.2 compiler and like it much for the speed.  Shows potential bugs which I need to optimized.

Also reading other iPhone books from library

Besides the Core Data book, I have also borrowed two other iPhone books for my bedtime reading.

Programming the iPhone User Experience expands on the required Apple HIG.  Good read, especially on parts of iPhone UI that you seldom use.

The iPhone Developer’s Cookbook has lots of sample code that I may use later.  Wish I had this book earlier.  Although a bit outdated, but still great as a reference.

OK and no point buying these books as you can get them from the library when you need them.

TableView and TableViewCell again

Although the tableview and tableViewCell are probably one of the first you will learn when starting the iPhone SDK.  Most of the time, you will just mangle it using some of the more popular and easy way to populate the cell.

For me, I found using this way works out best for me.

Create all the necessary labels in init. For each labels, create a function to return CGRect that describe the actual position and layout.

CGSize ratingSize = [rating.text sizeWithFont:[UIFont boldSystemFontOfSize:24.0]];

self.contentView.bounds.size.width

Use the bounds sizes and get the label  CGSize to determine  required space for the label.

In your layoutSubViews, [sizeLabel setFrame:[self sizeLabelFrame]];

Now, you can put labels exactly where you want it in your TableCell.  This should work for other views too.

PS.  This will be important when you port your iPhone app to iPad should you need  shouldAutoRotate.

Category: iPhone  Leave a Comment

Borrowed the Core Data book from library

Guess what?  The author Marcus is actually the famous blogger at Cocoa is My Girlfriend.  Got lots of good tips from him, especially the iPhone chapter.  Give me better insight to the Core Data API.

Highly recommended reading

Clash of the iPhone & iPad SDKs

It seems like in the haste of installing 3.2 beta, together with the latest 3.1.3 can crash your Xcode build settings.

It is highly recommended that you install beta SDKs in separate folders as compared to the standard /Developer for the released SDKs.  Found this out the hard way, and now all my build codes are default to /Users as compared to the usual /3.1.3 The mixed up is too painful to comprehend. “Ouch” X!

Found some information regarding this at the Apple support. I will try to remove all traces of the beta.  Do comment if you have discover any work around.

Additional info from tuaw  here