Embedding UITables into UIAlertViews

October 10, 2009 by Skylar · 2 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 · 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.

Localizing your iPhone OS applications in Xcode.

August 19, 2009 by Skylar · 6 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 · 31 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 · 1 Comment
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

Dynamic rounded rect drawing w/Multitouch

August 12, 2009 by Skylar · 2 Comments
Filed under: Uncategorized 

Some of you might want to do Multi Touch within your application, but are a little confused by Apple’s tutorial at http://developer.apple.com/iphone. Well, I tried to simplify things a little bit.–I made a code sample that simply draws a rounded rect whose size is what you make with your fingers. Read more

Getting to know Xcode/Interface Buider: PART III

August 11, 2009 by Skylar · 1 Comment
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 · 1 Comment
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

How to begin programming for the iPhone OS

August 9, 2009 by Skylar · 1 Comment
Filed under: iPhone Development 

The following is a work in progress. If there is anything that is unclear, or that I am missing; or if there is anything that I am just plain wrong about, please let me know in the comments. Thanks!

Programming for the iPhone or the iPod touch.  It’s one of those topics that interest many of you out there.  But for many, the topic is just too shrouded in mystery.  There just isn’t a whole lot of documentation on what you will need to get started.  I’m going to attempt to fill in some gaps and try to help you all understand.

What you’ll need:

  • First of all, you’ll need a computer*. An Intel Macintosh computer running OS X (>10.5) is highly recommended. Using any other platform will require more work on your end.
  • An iPhone OS compiler.
    • For most people, this will be the actual iPhone SDK, which can be downloaded directly from Apple’s iPhone developer site.Note however, that this SDK can only be used on Intel based Macintosh computers running OS X (>10.5).
    • If you are running a Linux system, you will need to build the toolchain yourself. The toolchain is a collection of tools, compilers, and linkers that will build and link iPhone applications. Jay Freeman (saurik) has written up a guide for building the toolchain for the iPhone OS 2.x environment.
    • If you are on a Windows machine, you will need to first obtain and install Cygwin, which can be downloaded here: www.cygwin.com. Instructions for setting up Cygwin and a list of required binaries can found at modmyi.com/wiki
    • If you are using your phone as a build platform, then you can follow WiFone’s instructions over at pimpmiphone.info

Once you have the above two set up and ready to go, you will be all set to get up and program.

Some resources you may wish to obtain:

And finally, here are some links to a simple project designed to get you familiar with working with Xcode and Interface Builder (only for the Macintosh):
Getting to Know Xcode/Interface Builder Parts I and II, part III

Drawing

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

Want to create a drawing app? Here you go. Clearly, you will need to make improvements to the drawing code, as I literally spent five minutes making this to test something for another app. Regardless, you should be able to get the gist of what’s going on. What I am linking is just your basic standard xcode view based project. The only pertinent part of this are the touchsBegan, touchesMoved, and touchesEnded methods, which I will be posting in this thread.

To draw, simply draw. To move your finger over the screen. To create a dot, tap the screen. To clear the screen, double tap the screen. Simple.

Read more

Next Page »