Posts tagged iPhone
iPhone Memory Debugging with NSZombie and Instruments
Jan 15th
NSZombie is easily one of the most valuable tools in any Cocoa developer’s toolbox. Check out Mark’s blog for a great introduction on using NSZombie from within Instruments:
iPhone Memory Debugging with NSZombie and Instruments | markjnet.
Thanks to Jeff LaMarche for directing me to Mark’s blog in the first place.
UIView Manipulation Made Easier with a Category
Jul 27th
I was watching a presentation recently where the presenter showed the header for a category that he had added to UIView to make his life a little easier. The point of the talk did not center around the category so I never saw much more than the header, but that was all I needed to recreate it for my use. Here’s the header:
#import <uikit/UIKit.h> @interface UIView (MFAdditions) - (id) initWithParent:(UIView *)parent; + (id) viewWithParent:(UIView *)parent; // Position of the top-left corner in superview's coordinates @property CGPoint position; @property CGFloat x; @property CGFloat y; // Setting size keeps the position (top-left corner) constant @property CGSize size; @property CGFloat width; @property CGFloat height; @end
As you can see there isn’t a whole lot to this category, but if you’re doing a lot of view manipulation the benefits of it will rapidly become clear. There was one sticky wicket that I hit when implementing this class and it centers around this method:
+ (id) viewWithParent:(UIView *)parent;
When I first implemented this method I wrote it like so:
+ (id) viewWithParent:(UIView *)parent { return [[[UIView alloc] initWithParent:parent] autorelease]; }
This was all well and good as long as the only class that I was creating was a UIView, but I ran into trouble when I started creating UIImageViews. Instantiating new UIImageViews worked fine, but as soon as I called a UIImageView-specific method the app would crash:
*** -[UIView setImage:]: unrecognized selector sent to instance 0xd1b350
I struggled with the answer to this one for a while and it wasn’t until I presented my problem to the local CocoaHeads group did I get it all figured out. Here’s the correct way to write this method:
+ (id) viewWithParent:(UIView *)parent { return [[[self alloc] initWithParent:parent] autorelease]; }
By calling self instead of strongly typing the returned object as a UIView the class would dynamically determine the correct type at runtime.
You can download this category here: UIViewAdditions
Standard iPhone Element Sizes
Jul 22nd
Great quick reference for Standard iPhone Element Sizes at Jonathan George‘s site.
iPhone Development: Updating Project Hint
Jul 15th
Jeff posts a great hint that answers some problems that folks were having with one of my older posts, Finding Memory Leaks With The LLVM/Clang Static Analyzer
Check out Jeff’s post here: iPhone Development: Updating Project Hint.
WWDC09 Sessions & Labs
Apr 7th
Apple has posted the first set of scheduled sessions and labs for this year’s WWDC here: Worldwide Developers Conference 2009 – Sessions & Labs.
Off the top of my head I think I will be keeping an eye on:
- Advanced Debugging
- Cocoa Tips and Tricks
- Concurrent Programming in Cocoa
- Effective iPhone App Architecture
- Embedding Maps in iPhone Applications
- Performance Tuning with Shark on Mac and iPhone
- User Interface Design for iPhone Apps
Which ones do you have your eyes on?
In Which I Join United Lemur
Nov 2nd
The past few weeks have been quite the whirlwind of activity here at Camp Fruit Stand, and I have some exciting news: I am now an intern at United Lemur, working on an iPhone game for them, and loving every minute of it.
As I look back at the date on my last post I’m not surprised that it’s been over a month since I last had a chance to put anything into print. Any free time that I have had has been spent either working on the house or reading the developer documentation from Apple on how to write software for the iPhone.
Even though I’m the “new guy” everyone has welcomed me with open arms and instantly made me feel like a member of the team. From day one I was given a new name (I am now known as Mike McChristopher among my fellow lemurs), a new email address, and full responsibility for a project that will result in another great United Lemur app in the App Store.
It has also been fantastic to be behind the scenes in the troop’s chat room as their initial foray, Puzzllotto, has played out and to watch as they prep their next big thing.
I think one of the best things about having the opportunity to join this troop is that I am part of an incredibly talented group of developers, designers, and engineers that aren’t just doing this to get rich. Something great happens to a person when they are exposed to others in their field that are so obviously passionate about what they do.
I’d also like to take a few words to thank Mike Lee. From the beginning Mike has been one of the nicest, most easy going, easily approachable guys I’ve ever had the pleasure to meet. He has given me an incredible opportunity by allowing me to join him in his crusade to save the lemurs and for that I thank him.
Now don’t worry, I will still be creating new posts here (in fact I’ve got a couple in the queue already), but be warned: my future posts might have a bit of lemur scent on them.

