Aug 25

UITableView iPhone Programming Tutorial – Part 1

For MORE lessons like this, visit MyCodeTeacher.com I Build iPhone Apps! Just e-mail me and let me know what you need built! NOTE!!! View this at higher quality here: vimeo.com A tutorial that teaches iPhone programmers how to populate a UITableView. SOURCE CODE: #import “TableViewTestAppDelegate.h” @implementation TableViewTestAppDelegate @synthesize window; – (void)applicationDidFinishLaunching:(UIApplication *)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:identity]; 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 E-mail me for .zip
Video Rating: 4 / 5