Dismissing the keyboard before you do something else is just good UX. So for example we want to move to another screen, but want to make sure that the keyboard dismisses before this happens (because otherwise the keyboard would be in front of the push animation). So here, we set a delay for the completion […]
Here is a fun way to create a generic UIAlertViewController. I have this setup as a class method in my Singleton. You can configure this to have text fields and buttons with the following code: In the above example, when you press OK, you will see in the console the username and password printed out. […]
Here is a nice way to increment the build number for your app. Every time you build your project this will add a number to CFBundleVersion. This also adds the build time and date to your info.plist. In order for this to work, you need to add a new entry to your plist called CFBuildDate, […]
I’ve found myself needing to get the time and date (formatted) quickly, so I’ve come up with this simple solution. Of course, you can take this to the next level and get really creative with it using a … that’s right, Preprocessor Macro!
Here is a fun way to show local notifications. The first showLocalNotificationWithTitle: andAlertAction: will show a notification to the user via the banner as well as place the message in the Notification Center. The second method application: didReceiveLocalNotification: demonstrates how to direct the user based on the action of the notification. For example, if you […]
Here is an easy way to use a sequence of images as a single animated UIImage. The concept behind this is to add your images in sequential order and return an animated image. This is has less math involved than actually using CoreAnimation and is only available in iOS 5.0 and beyond, you will need […]
These handy macros allow you to easily check the system version in the form a string. You can use one of the following macros to check what version of iOS the user is running and based on the value provide a system-specific feature. For example, the Twitter framework that is available as of iOS 5.0.
I like to use 1 controller for my universal apps. There’s no need to use RootViewController.h and RootViewController~iPad.h and write the same code twice! Here is how I use 1 controller for both iPad and iPhone specific code. If you haven’t read my post on how I use Macros, check it out. One way to […]
I find it easier to use html hex colors instead of converting RGB to UIColor blah blah blah. So here is a sweet little snippet to do just that. This piece of code allows me to use Photoshop or any other software with a color picker to get a specific color and use it in […]
I just recently started using a Globals.h file as my staging ground for my macros. Where ever you want to use any of the macros, just use #import “Globals.h”. You can use this file to store an AppDelegate instance and many other static options you wish to use. Here is an example of what one […]