How to convert an NSString to Char

June 26th, 2009

Another quick tip!

If you need to convert from an NSString format to a Char format, it’s a really easy one line of code as follows;

const char *fooBar = [barFoo UTF8String];

Here, fooBar is your new Char and barFoo is your previously allocated NSString.

Simple!

Cheers

Graham

How to concatenate strings on the iPhone

June 26th, 2009
Objective-C on the iPhone isn't always the easiest of languages to get you head around. Somethings that are easy in other programming languages can be a bit more obscure.

One thing that I've done a lot in VB.Net is string manipulation. It's easy, straightforward and very powerful!

The documentation around strings is thorough, but lacks enough examples of code usage in real life situations!

So, if you need to concatenate two or more strings together, use this example below!

NSString *foobar = [NSString stringWithFormat:@"%@%@", aStringObject, anotherStringObject];

Don't forget to leave a space or spaces, if you want spaces between your strings!

Happy coding!

Cheers

Graham

Version 1.0.3 of iAboutClock is now available!!

May 29th, 2009

The latest update of our flagship application, iAboutClock, is now available for download in the iTunes App Store!

The new version, iAboutClock 1.0.3, allows the user to customise the time settings.

So instead of it showing the time as ‘It’s More or Less Five’ you can edit the time to show ‘It’s More or Less Home Time!!’.

It’s only limited by your imagination!

It's More or Less Bed Time!! It's Not Quite Half-Past Beer Time!It's Roughly Home Time ;-)

Great for having a laugh with your friends!!

Get it on the App Store

Setting the font size on a text field

May 20th, 2009
A quick tip for the frustrated iPhone developer!!

Even if you set the minimum font size in Interface Builder for a UITextField, it doesn't work how it should!

Here is a one line fix!!

myUITextField.font = [UIFont systemFontOfSize:12.0f];

Cheers

Graham

Installing V3.0 Xcode SDK and V2.2.1 Xcode SDK at the same time!

May 13th, 2009

Apple announced that all applications submitted to the iTunes App Store must work on both 2.2.1 and 3.0, in order to make it through the submission process. If you application doesn’t work on V3.0 it won’t go up for sale. It’s as black and white as that!!

However, you can’t create V2.2.1 versions in V3.0 Xcode, so you must install both versions onto your Mac!

It’s easier then you think!

When you install V3.0, you get the option of where to put the install files. By default, this will be in the Developer folder on your Mac Hard Drive. When you get to this stage on the pre-install menu, choose a custom folder that you can create on the drive in a different location of your choosing.

It’s as simple as that!

Don’t forget where you’ve decided to place it, as you will need to access that folder in order to run V3.0.

Happy coding!!

Cheers

Graham