Category / Objective-C

With Xcode 4 you can develop applications for iPad and iPhone. Also, you can choose a different iOS target. Currently, the last release of iOS is 4.3 and when you will create a new project you will see:

Now, the rootViewController property has been added with iOS 4. This mean that when we going to […]

Read More

Apple suggests to use an instance of NSFileManager class and avoid the static class method defaultManagerbecause it will return a singleton instance: no thread safe: In Mac OS X v.10.5 and later you should consider using [[NSFileManager alloc] init] rather than the singleton method defaultManager. Using [[NSFileManager alloc] init] instead, the resulting NSFileManager instance is […]

Read More

If you  would like to avoid to set the background image of main view controller through Interface Builder, you can use a different way and delete the UIImageview object from Interface Builder:

You may use viewDidLoad as well but viewWillAppear avoid some flickering. With Xcode 3.2.5 is not possible to use the pattern yet.

Read More

How to merge one or more images

Read More

Let’s see some useful method about NSURL Return the name of a file (with or without extension) from NSURLRequest:

Return the file extension from NSURLRequest:

Finally, How to convert an address from NSString to NSURL and vice versa:

Read More

Currently, in Objective-C does not exists a class that provides a simple way to generate a random number. Anyway, we can use some C functions like: rand(), srand(), random(), srandom() e arc4random().

Read More

NSTimer is used is several context. However, you have to to careful when you are going to invalidate the variable. For example:

Usually, you will use:

As you can see in the code above, the timer is switched off but the variable is unset, so it is dangerous. The best way could be: […]

Read More