
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 1.11 KB | hits: 13 | expires: Never
Loading Table View when clicking on cell
- (void)viewDidLoad
{
self.title =@"Warranty Length";
timeLeftArray = [[NSMutableArray alloc]init];
[timeLeftArray addObject:@"One Year"];
[timeLeftArray addObject:@"Two Years"];
[timeLeftArray addObject:@"Three Years"];
[timeLeftArray addObject:@"Four Years"];
[timeLeftArray addObject:@"Five Years"];
[timeLeftArray addObject:@"Six Years"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [timeLeftArray count];
}
- (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];
}
// Configure the cell...
cell.text= [timeLeftArray objectAtIndex:indexPath.row];
}