Return to   |   Check out   |   How to Post Snippets  

Not registered? Thats okay! You can Submit a Snippet without being a member of this site!

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!

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 […]

Here are a few examples of how to add a UINavigationBar item, wether it’s a “Done” button or an Action button, these can be done in 1 line of code as well (throughout your main source files of course). How to use: In the first example, @”Back” is used as the button title telling the […]

Quick and easy check to see if the iOS app is running on the iOS Simulator and display a message. You can also pre-define the message and remove (MSG). How to use: This example is similar to UIAlertView Shortcut Macro, only difference is there is 1 argument.

I just recently got heavily into using preprocessor macros. These macros cut down on code in your main source files. Here is an easy way to use a macro to show a UIAlertViewM in 1 line of code. When using a multiline macro like this example, you insert a \ at the end of each […]

© Copyright 2011 Wright's Computer Services.   All rights reserved Suffusion theme by Sayontan Sinha