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


  1. with so many crappy iPhone learning sites out there, developers are having a hard time finding the right training resource and program. EDUmobile. ORG has changed that with their iPhone Training Program that is currently teaching over 100 students.

  2. Cool video, I just got my Mac set up and started iPhone programming. One question, how did you change the color of the Finderbar? Is it a skinning program?

  3. I don’t believe you can. I know that you can use C++ scripts for Audio Programming (but Apple has setup the iPhone programming environment for that). I don’t know about Python. I would suggest just learning Objective-C, it’s a wonderful language.

  4. Question: in the app delegate code file you create the contentArray as with the retain keyword:

    contentArray = [[NSArray arrayWithObjects:@”First”, … , nil] retain];”).

    Shouldn’t you subsequently release the contentArray object in the dealloc method?

    [contentArray dealloc];

Leave a comment