Changing colors of UINavigationBarButtons

November 5, 2009 by Skylar · 5 Comments
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 · 13 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 · 5 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

Embedding UITables into UIAlertViews

October 10, 2009 by Skylar · 6 Comments
Filed under: iPhone Development 

The newer Apple firmware will create a table in your UIAlertView automatically if you create a more than the number of buttons that fit onto the alert. Note that this number is different in landscape and portrait modes. I found the implementation to be very unappealing for a few reasons. First of all, you won’t really know if you will have buttons or a table until after you compile and test the application. Plus, if you want to display a table, but you only have a few options, then there’s no real way to get that with the standard UIAlertView. And finally, what if you had wanted to customize the table with colored cells, custom cells with images on them, or take advantage of the editing properties of the table and its “Swipe to delete” feature? What if you want a table with multiple sections? You would be able to do none of the above with the standard UIAlertView.

So instead, I decided the best option would be to create another custom UIAlertView whose sole purpose is to display a table.

Read more

Don’t use UITableViewController. Really.

September 24, 2009 by Skylar · 17 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.

Localizing your iPhone OS applications in Xcode.

August 19, 2009 by Skylar · 10 Comments
Filed under: iPhone Development 

Localization from within Xcode is a little unnatural at first. And to tell you the truth, I still don’t like it is handled. But that’s neither here nor there. This post will show you how to add support for localization within your own application.

Localizing

The first thing you need to do is localize your application into your native language. To do that, you must first create a Localizable.strings file. What you will do is select “New File…” from Xcode’s dropdown menu. Highlight the “Other” menu and select “Strings File.” Name this file “Localizable.strings.”

Read more

Custom UIAlertView (Color chooser)

August 14, 2009 by Skylar · 40 Comments
Filed under: iPhone Development 
PTColorChooser.png

PTColorChooser.png

In this post, I am going to show you how to make a custom UIAlertView, as seen in the above screenshots and this video. The custom UIAlertView is a color picker that is taken right out of my PocketTouch application (available on the AppStore very soon!).

To do anything custom to an alert view, we need to subclass it out. Go ahead and do so, and set up the interface for your UIAlertView like you will see in the following example.
Read more

Creating a PreferenceBundle for the iPhone.

August 12, 2009 by Skylar · 3 Comments
Filed under: iPhone Development 

IPhone Settings Within Settings.app

This document assumes that the reader has intermediate to expert knowledge and skills in the creating of applications for a jailbroken iPhone or iPod Touch. If you have any questions regarding this material, feel free to comment below.

Read more

Getting to know Xcode/Interface Buider: PART III

August 11, 2009 by Skylar · 2 Comments
Filed under: iPhone Development 

This tutorial is an extension of http://www.skylarcantu.com/blog/2009/08/10/getting-to-know-xcodeinterface-buider-parts-i-ii-uitabbar-projects/. To get the most out of this tutorial, please either follow the linked tutorial, or download the sample project from the first post of the linked tutorial.

So, we have this beautiful tabbed project, built up in Interface Builder, and all is looking pretty good. But now, you want to do something with it. So let’s add a button and a label to our project. We’ll start by opening up Xcode and opening our FirstViewController.h. We will be adding a few variables here. A UIButton object, a UILabel object, and an integer called ‘count.’ Once those are added, we’ll set the two objects as properties of our FirstViewController. Make sure to preface the objects with IBOutlets, else Interface Builder will ignore the objects. Properties allow other objects to refer to the variables directly by referring to them within the object that contains them. Specifically, anObject.property. And finally, let’s create a method for what to do when our button is pressed. When completed, your finished FirstViewController.h file should look like this:

Read more

Getting to know Xcode/Interface Buider: PARTS I & II: UITabBar projects

August 10, 2009 by Skylar · 2 Comments
Filed under: iPhone Development 

Alright, it seems that a lot of you are missing a few steps when it comes to connecting together Xcode and Interface Builder. Hopefully, this will help you see things a little clearer, and see how things work a little better. This tutorial will show you how to create a simple UITabBar based application whose tabs are loaded from separate nib files.

The first thing you’re going to want to do is open a new project. Select a “Tab Based Application” and call it “CountAppula.” Be forewarned, when you submit an application to the AppStore, you can’t have any spaces in the name. You can change the display name in the Info plist to display “Count Appula” if you feel so inclined.
Read more

Next Page »