Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-25-2009, 05:23 AM   #2 (permalink)
simpsonaty
simpsonaty Apps
 
simpsonaty's Avatar
 
Join Date: Dec 2009
Location: Australia
Posts: 93
simpsonaty is on a distinguished road
Default

It would be much easier to use IB to create your UITableView and populate the array. You can start populating the NSArray in the - (void)viewDidLoad method. Don't forget to add the array in the .h header file.

Code:
- (void)viewDidLoad {
myArray = [[NSArray alloc] initWithObjects:@"1", @"2", @"3", nil];
[super viewDidLoad];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}

// Set up the cell...
cell.text = [myArray objectAtIndex:indexPath.row];
return cell;
}
__________________
http://simpsonatyapps.com
... yep, that's our site.
simpsonaty is offline   Reply With Quote
 

» Advertisements
» Online Users: 642
20 members and 622 guests
ADY, baja_yu, Creativ, dacapo, djbrooks111, e2applets, flamingliquid, headkaze, KarlJay, matador1978, msovani, MysticLine, Oral B, sacha1996, SLIC, smithdale87, SuperDietGenius, wiltwitt, Xaphann
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,421
Threads: 94,016
Posts: 402,539
Top Poster: BrianSlick (7,978)
Welcome to our newest member, maryleeag34
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:50 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.