April 15, 2009
Join myself, Blake, Wayne (and more!) tomorrow between 4 and 6p at the Dark Horse Cafe, 215 Spadina Avenue (just north of Queen) for Coffee and iPhone. Bring your MacBook, your iPod, your iPod Touch or just yourself and we’ll talk all things iPhone and mobile.
- What: Coffee & iPhone
- When: Thursday, April 16 from 4 – 6p
- Where: Dark Horse Cafe, 215 Spadina Avenue (at Sullivan Street)

At the last Coffee & iPhone we had the following attendees:
Note that this is the day before Joey’s Coffee & Code, at the same location!
April 1, 2009
Join myself, Blake, Wayne and more tomorrow between 1 and 3pm at the Lettieri Cafe at 581 Bloor West (at the corner with Bathurst) for “Coffee and iPhone”. Bring your MacBook and we’ll talk all things iPhone development.
View Larger Map
March 27, 2009
This code could be very useful for iPhone developers:
The name of the new project is Three20, after the 320-pixel-wide screen of the iPhone. The code is all hosted on github for your cloning pleasure. There is an excellent sample app called TTCatalog which lets you play with all of the various UI components. Documentation? Well… there are instructions for how to add Three20 to your project, but I am still working on comprehensive documentation for each of the classes. For now, the sample app and the code itself are your documentation.
The projects are:
- Photo viewer
- Message composer
- Web image views
- Internet-aware table view
- Better text fields (including type-ahead)
- HTTP disk cache
- URL-based navigation (this could be interesting)
The source base is under the Apache license.
March 23, 2009
If you have not created a XIB, do the following:
- select Resources in the Interface Building
- press ⌘N
- select User Interfaces in iPhone OS
- select View XIB … and create in the normal way
To create the Simple Table in the Interface Builder
- open the XIB in Resources
- drag the Table View from the Library to the View … it should resize to the full extent of the View
- select the Table View object and press ⌘2
- from the Outlets section, drag
- dataSource to File’s Owner
- delegate to File’s Owner
- save
Make your Controller.h a data source and delegate for the table:
@interface ThemesController : UIViewController
<UITableViewDelegate, UITableViewDataSource>
{
}
Add the following basic code to the Controller.m file:
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger) tableView:(UITableView*) tableView numberOfRowsInSection:(NSInteger) section
{
return ... the number of rows ...;
}
- (UITableViewCell*) tableView:(UITableView*) tableView
cellForRowAtIndexPath:(NSIndexPath*) indexPath
{
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier: SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.text = ... an NSString containing what to display for row row ...;
// cell.image = [UIImage imageNamed:@"star.png"];
return cell;
}
#pragma mark -
#pragma mark Table Delegate Methods
- (void) tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
}
Compile and run.
Property Lists – plists – are a standard way of storing data in iPhone and MacOS programs. Here’s how you use them on the iPhone.
Add this code to Controller.m to populate member listData with the data from plist dwarves.plist:
- (void) viewDidLoad
{
NSBundle* bundle = [NSBundle mainBundle];
NSString* plistPath = [bundle pathForResource:@"dwarves" ofType:@"plist"];
NSArray* dwarves = [[NSArray alloc] initWithContentsOfFile:plistPath];
self.listData = dwarves;
[dwarves release];
[super viewDidLoad];
}
To create the plist:
- open and select the Resources folder in Interface Builder
- right-click and select Add > New File…
- select Other in the popup (at the bottom)
- select the Property List icon and then press the Next button
- choose your name and Finish
To edit the plist:
- select it in the Resources Folder
- right-click and select Open with Finder
Make sure:
- the name of the plist in the code (
dwarves) is the same as the plist you created
- the type of the plist in the code (
NSArray) is the same as the plist you created – by default it is actually NSDictionary, which is the other common option