Private API iPhone button creation

This is cool. Use the private API UIGlassButton in the iPhone simulator to create button images. Then import the images in your project and leave the private API call out.

Used iPhones are still worth big money!

A month or so ago I finally broke down and upgraded our iPhones to 3G, and sold our old ones on Ebay. It worked out well.

Bought - 2 16gb iPhone 3Gs, $300 each + tax & misc AT&T fees.
Sold - 2 8gb first gen iPhones for $330 and $335 - about $20 each for Ebay/Paypal fees and shipping.

So the initial purchase is pretty well canceled out. The new service plan is eligible for corporate discounts, so hopefully my discount will cancel out the more costly monthly bill.

Use NSUserDefaults to persist data between app runs

On the iPhone you generally want your application to start looking like it did when it was last run to give the user the impression your app is ready to pick up where it left off. NSUserDefaults provides an easy way to store your application’s settings between runs. Simply create an instance of NSUserDefaults and give it the key/value pairs you want it to save.

Storing an integer

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setInteger: myIntValue forKey: @"intValueKey"];
[prefs synchronize]; // writes modifications to disk

Reading it back in

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
int myIntValue = [prefs integerForKey: @"intValueKey"];

or more simply

int myIntValue = [[NSUserDefaults standardUserDefaults] integerForKey: … Continue Reading

NSNotificationCenter

I just learned about NSNotificationCenter. Any class in a program can send a notification message to the notification center, and all classes can listen to the center and respond to messages that apply to it. It’s kind of like a callback, but really not.

This is part of my code for implementing a custom keyboard in my iPhone app.

To send a notification named “keyboardDone” to all objects in your program.
[[NSNotificationCenter defaultCenter] postNotificationName: @”keyboardDone” object: nil];

To listen for the “keyboardDone” notification and call the “keyboardDoneObserver:” method when it’s received this can be added to your class’ init code.
[[NSNotificationCenter defaultCenter] addObserver: self … Continue Reading

Adding a code beautifier script to Xcode

Xcode’s re-indent command is pretty weak compared to the code reformatting built into other IDEs. It fixes the indentation at the beginning on each line, which makes a huge difference in code readability, but I don’t think it does anything else. In Eclipse and VS I’ve gotten used to being fairly lazy about being consistent with my spacing elsewhere and relying on their built in reformatting to clean it up for me. I wanted to change the way Xcode reformats code, since it’s easier to change tools than to break bad habits.

I spent some time searching for command line code … Continue Reading

Activating iPhones. Two iPhones - one family plan

Over the weekend my wife and I upgraded our cell phones.
We’ve had a family plan with T-Mobile for several years and had been fairly happy with it. Especially the price, both of our phones combined only cost us about $50/month. Lately we’ve both been having problems with the service, which makes me think T-Mobile is having network problems as opposed to one of us having a bad handset. For the last couple months we would make or receive calls and we would be able to hear the person on the other end but they would not be able to hear … Continue Reading

AK Octane chair

Last week I purchased my latest cheap office chair. It’s an AK Designs Octane chair purchased from Best Buy. My experience is that any of the sub-$200 chairs purchased from retail stores will last about two years before the mechanism that allows the chair to rock and turn will wear out to the point that it loudly squeaks when you use it. At $150, I fully expect this chair to be no different.

The good

This chair is just really comfortable. The sides of the back wrap around you so it feels similar to a sports car seat designed to hold … Continue Reading

Trying Windows Vista

Over the weekend I decided to test Windows Vista on my old PC. The install and hardware support were better than I expected considering the several articles I’ve seen and the coworker who assured me that my nVidia nForce2 motherboard (Abit NF7S) chipset was totally unsupported under Vista.

The install was fairly straightforward. Since I have an MSDN subscription and this is my .NET development machine, I could legally download the Vista ISO from the MSDN download site. The install was straightforward, and while nVidia does not offer drivers that can be downloaded, the NIC was supported in the original install … Continue Reading

New Mac in the house

Yesterday we stopped at CompUSA to look for a new MP3 player for my wife. We are going on a trip in a few weeks and she wanted something cheap to listen to on the flight, and we were thinking of a 2GB Sandisk or something comparable for around $100 or so. The idea of cheap didn’t work out so well, we ended up with a 80GB video iPod and a Macbook Pro. Nice impulse buy, huh? We had been planning on her buying a new laptop soon anyways, and she’d been leaning towards switching to a Mac since I’ve … Continue Reading

Mac switcher tip - Two for one special

Apple should produce a nice ergonomic keyboard. Since they don’t, I’ve resorted to using a Microsoft wireless natural keyboard and mouse. Microsoft has Mac drivers that add a new control panel to the system preferences, and other than my needing to remember that the Alt key is really my Command key everything is good. Except for the first couple times the Mac went to sleep. With the original Apple keyboard I would press a key or move the mouse to wake from sleep, but this won’t work with the Microsoft keyboard. I needed a workaround.

The first tip is that you … Continue Reading

Page 1 of 41234»