Changing colors of UINavigationBarButtons

November 5, 2009 by Skylar · Leave a Comment
Filed under: Quick Tip, iPhone Development 

Alright, here’s another quick tip. “How to change the colors of a button on a toolbar.” Of course, this can be applied to any toolbar but I am going to demonstrate the procedure on a UINavigationBar.

Read more

Saving a view as an image.

October 16, 2009 by Skylar · 6 Comments
Filed under: Quick Tip, iPhone Development 

Another real quick tip for you. Depending on what you’re doing, why might want to capture a view and store it as an image. The frameworks make this quick and painless.

The first step you should take is to create a new image context in which we will be working. The next step is to render the view’s CALayer into that new context. Finally, we get an image from that context and close out the context.

In the following code, I use the UIWindow (UIView subclass) for the sample as a way to get a quick and easy screenshot.

Read more

Alternate UISwitch Colors

October 14, 2009 by Skylar · 3 Comments
Filed under: Quick Tip, iPhone Development 

Once again, Apple has another quite nice method in their bag of UIKit tricks that they don’t want developers using for some reason. The alternate colored UISwitch. This is often used to catch the user’s attention and make them take note. Look at the “Airplane Mode” switch, for an example. Or, the following screenshot:

Read more

Don’t use UITableViewController. Really.

September 24, 2009 by Skylar · 9 Comments
Filed under: Quick Tip, iPhone Development 

I was hesitant to even begin writing this blogpost for two reasons. First of all, I knew it would be short. More importantly, though, it’s because I know some people swear by the opposite. However, I must insist that you should never use a UITableViewController in your iPhone applications.

Let’s go over the reasons to use a UITableViewController.

  • It’s a subclass of UIViewController, so it’s simple to use.
  • UITableViews must have a delegate and a datasource. UITableViewControllers automatically conform to the requisite protocols. The file template even comes with the necessary methods included.

Really, when you think about them, both of those two points are non issues. If UITableViewController is a subclass of UIViewController, why not just use a UIViewController with a UITableView on top of it? Also, conforming to to the delegate and datasource protocols is as simple as adding to your UIViewController’s interface.

Let’s now cover a few reasons why you won’t want to use a UITableViewController.