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
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 [...]
There are a number of different methods for creating random numbers in Objective-C.
Here is a method for creating a random integer between and including zero and a given number, that you have entered into the code.
This code gives a number up to 21;
int myRandomInt = arc4random() % 21;
Give it a go and let me know [...]
So, you want to either do some calculations using dates or you just want to break up the time into hours, minutes and seconds.??
This is easy to do, using the built-in NSDate class within Xcode. Prior to the 2.2.1 iPhone update, I used a different method, but this was ‘broken’ by the update, as once [...]
If you have an application that requires the iPhone from going to sleep when the user is not touching the screen or otherwise interacting with the iPhone, you need to disable the idle timer.
This is very easily done in code, but remember, it does use up more battery life, so the idle timer should only [...]