screen-capture-1

Este tutorial explica os conceitos básicos de uma UITableView, seus métodos, instruções e conceitos para fazer a sua primeira programação utilizando Table Views

Classes:

“RootViewController.h”

@interface RootViewController : UITableViewController {

}

@end

“RootViewController.m”

#import “RootViewController.h”

@implementation RootViewController

- (void)viewDidLoad {

[super viewDidLoad];

[self setTitle:@"Table"];

}

#pragma mark Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 5;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return 2;

}

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

static NSString *CellIdentifier = @”Cell”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

}

[cell setText:@"Minha primeira célula"];

return cell;

}

- (void)dealloc {

[super dealloc];

}

@end

Download do arquivo

Share and Enjoy:
  • Print
  • Digg
  • Facebook
  • Google Bookmarks
  • email
  • PDF
  • RSS
  • Twitthis