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

Multitouch/Singletouch/Tap handling

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

In response to a recent iPTF thread in which no one was seemingly able to help the original poster, I made this quick little application. Hopefully you should be able to learn.

  • Single Tap on the beach ball – The beach ball will let you know you tapped on it by pulsing. User feedback is ultra important.
  • Drag your finger around the screen to move the beach ball wherever.
  • Using two fingers, spin the beach ball to rotate it on screen.
  • Double tap anywhere on the screen to reset the beach ball’s rotation and location.

Read more

Protocols made simple

August 4, 2009 by Skylar · Leave a Comment
Filed under: iPhone Development 

A topic that is certain to come up eventually is how to implement your own protocols. Such as UITableView’s datasource and cellForRow: and UIResponder’s touchesBegan: methods.

Possibly you create a certain new type type of button object, a worker object that reports when it is done, or any other possibility your wicked little minds can create. The reasons for delegation are virtually endless.

In the sample provided, I take a custom view of mine called PTGlossyView, which I subclassed into my PTStatusBar. You will be able to see this object and code in action with the release of PocektTouch 4.0 (available in the AppStore soon). I want touches on the PTStatusBar to react differently than the touches in the main view part of the application. In other words, I want swipes and touches in the application’s status bar to not be passed on to its super, and to perform its own touch methods.

Read more