Saturday, 4 August 2012

Asending order using TableView in iOS

The Ascending order coding are

NSSortDescriptor *lastNameSorter = [[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES];
    [listings sortUsingDescriptors:[NSArray arrayWithObject:lastNameSorter]];


In This table view we can add this coding in to

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell=[self getCellContentView:CellIdentifier];
}
//Place the  ascending order coding
return cell;
}

No comments: