Note: Since the introduction of custom URL schemes, this post has consistently been the top read content on the blog. Although much is the same, there are a few nuances that have changed. This is a re-write of the original post, updated for the latest iOS and Xcode versions.
One of the coolest features of the iPhone/iOS SDK is an application’s ability to “bind” itself to a custom URL scheme and for that scheme to be used to launch the application from either a browser or from another application.
I’ve found that defining a custom UIColor using RGB values is a little counter intuitive compared to the more common hexadecimal notation used in CSS. This is particularly true if you want to define a color value in a file and don’t want to have to split it into three separate values.
For the most part, NSScanner has everything we need to parse data types (int, float, string etc) from a string.
To continue on the types of URL Schemes that are supported by the iPhone (see Part 1); today I will show you how to:
- Launch YouTube
- “Deep Link” to content in iTunes
If you don’t take the necessary steps to prepare for subversion, you will run into problems using it in XCode. This is because XCode produces files that “confuse” Subversion because it either thinks they are text files when they are really binary files or the reverse. To overcome these limitations, you need to make some simple changes to the subversion configuration file in your user home directory. Here are some steps you can follow to ensure that you will be able to use Subversion within XCode without any issues.
Masking an image enables a developer to create images with irregular shapes dynamically. Masking is often used to create a user interface that is more compelling and less boring.
Take for example the following example …
Ever wondered how all of the applications on your iPhone seem to show a loading screen or “boilerplate” as soon as the icon is touched and wondered how they get the image to appear quickly? Well the secret is in the presence of a file in your application called Default.png.
Have you ever found yourself stumped because your application locks up but doesn’t seem to crash or in any other way indicate that there is an error? If you have, then you are likely the victim of a common problem that can occur when you attempt to make certain changes to the UI outside of the main thread. Put more technically … you are doing something that is not “Thread Safe”.
To avoid “freezing” your application, ensure that any logic that is changing your UI is performed by the Main thread. One approach to this would be to leverage the
NSNotificationCenter but sometimes that is overkill. A much simpler approach is to use one of the following
performSelectorOnMainThread methods on
Nine-times-out-of-ten this is the magic that will “thaw” your application and get it humming along again!