Back to the iPhone Index
I just upgraded my MacBook pro and my iPod Touch to use the iPhone SDK 3.0 and iPhone OS 3.0 respectively so I could test compatibility of my apps.

I ran into only a few problems. The most notable was that my code-generated buttons didn't have any text.

This turned out to be because something that worked in the SDK for 2.2.1 didn't work in the SDK for 3.0.

This used to work in 2.2.1, but doesn't in 3.0:
UIButton *btn=[[UIButton buttonWithType:UIButtonTypeRoundedRect] initWithFrame:frame];

So, in 3.0 I replaced it with this:
UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame=frame;

Another problem is that SDK 3.0 has deprecated some methods for buttons and table cells.

I handle buttons this way:

#ifdef __IPHONE_3_0
	button.titleLabel.font=font;
#else
	button.font=font;
#endif

I handle table cells this way:

NSString *theText=@"some text for the cell";
UIColor *textColor=[UIColor blackColor];

#ifdef __IPHONE_3_0
    cell.textLabel.text=theText;
    cell.textLabel.textColor=textColor;
#else
    cell.text=theText;
    cell.textColor=textColor;
#endif

Last updated: Wed Jun 17 19:05:02 EDT 2009


All content copyright Howard Cohen 2009, all rights reserved worlwide.
hoco(at)timefold(dot)com