Thursday, May 27, 2010

iPhone App Icon

Each app gets an icon for the home screen that's 57 x 57 pixels. Note that the iPhone automatically creates a beveled edge and adds a glossy finish (unless you specify otherwise; see below). Create the file as a PNG and add it the project. Next, add a line in the plist file for "Icon file", specifying the file name (less the extension) as the value. To disable the automatic border and gloss, add an additional line for "Icon already includes gloss and bevel effects", checking the box.

To get the finished icon to appear, you might need to clean the targets (Build > Clean All Targets).

Adding Music to an iPhone App

The instructions for using the AVAudioPlayer in the iPhone Application Programming Guide are pretty solid. There are a few required steps, however, that are not made explicit:
  • A player instance variable needs to be added to your class, e.g. AVAudioPlayer *player.
  • The AVAudioPlayer class needs to be imported in the header file, i.e. add this line to the top of the class's header file: #import
  • Make your class a AVAudioPlayerDelegate. In your class's @interface declaration, add AVAudioPlayerDelegate to the list of implemented protocols.
  • Add the AVFoundation framework to your app's link libraries. In XCode's "Group & Files" pane, expand Targets > [your app name]. Right-click on Link Binary With Libraries and select Add > Existing Frameworks. Select AVFoundation.framework and click Add.
Also worth noting: here's a good tip on making the music fade out.

Tuesday, May 25, 2010

Merging Windows XP Partitions

The C: drive on the old ThinkPad T41 has been close to full for a while, and I suspect this has been contributing to the increasingly awful performance. I received the laptop with 2 partitions on the 32GB hard drive: half of the space for the C: drive and half for the E: drive. Nobody really uses the E: drive so I decided to merge the two partitions.

I started with the GParted Live CD but quickly discovered that it didn't really support merging partitions. Because there was only junk on the E: drive, I used GParted to delete that partition and then tried to expand the C: partition. Unfortunately, GParted then detected a bad sector, and I couldn't get by that without retooling the partitions by hand. Lacking the confidence for that procedure, I downloaded the freeware version of EASEUS Partition Master. Within a minute of launching the program, I had successfully resized the partition to the full size of the disk.