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-26-2009, 08:45 AM   #3 (permalink)
losingSkillz
iPhone Developer
 
Join Date: Aug 2009
Posts: 64
losingSkillz is on a distinguished road
Post

Quote:
Originally Posted by simpsonaty View Post
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;
}

Thank you for the answer. I have tried using ib and i got it working. however, the [self.tableView reloadData] doesn't seem to work. i know that my array is not nil and it changed before i called [self.tableView reloadData].

also i have added a toolbar to the bottom of the screen but now my tableview is blocked by the toolbar. is there anyway to change the frame size of my tableview? i have tried self.tableView.frame = myNewFrame;
Happy Holidays!
__________________
If I helped you in any way, please help me by checking out my apps:

iPower Your Device --- Charge Up your device!

(FREE)


losingSkillz is offline   Reply With Quote
 

» Advertisements
» Online Users: 662
17 members and 645 guests
ADY, baja_yu, dacapo, djbrooks111, Duncan C, headkaze, iAppDeveloper, JoePitto, KarlJay, msovani, sacha1996, SLIC, smithdale87, smithms, spinyanteater, ukneeq, Xaphann
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,422
Threads: 94,017
Posts: 402,542
Top Poster: BrianSlick (7,978)
Welcome to our newest member, iAppDeveloper
Powered by vBadvanced CMPS v3.1.0

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