Top of the page
Close

This is a red error

This is a red error

This is a red error

UITableView iPhone Programming Tutorial

Ondrej Rafaj on 2009.07.01 09:11:39

A tutorial that teaches iPhone programmers how to populate a UITableView by Anthony Frizalone

Video tutorial on Vimeo

Source code:

#import "TableViewTestAppDelegate.h"

@implementation TableViewTestAppDelegate

@synthesize window;


- (void)applicationDidFinishLaunching:(UIA pplication *)application {
contentArray = [[NSArray arrayWithObjects:@"First", @"Second", @"Third", nil] retain];
[window addSubview:[mainNavController view]];
}

- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return [contentArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identity = @"MainCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identi ty];
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:identity] autorelease];
}
cell.text = [contentArray objectAtIndex:indexPath.row];
return cell;
}

- (void)dealloc {
[window release];
[super dealloc];
}

@end

Ondrej Rafaj

Ondrej Rafaj

Technical director @ Fuerte International

Back to top Comment

Comments ... Why not to get involved!
HTML Comment Box is loading comments...

Old comments:

Back to top

IE SUCKS, DON'T USE IT :) Digg this page