May 18, 2009

Swipe Delete From UITableView

You probably like to use swipe to delete elements from UITableView. Here you have a short example how to implement so in your iPhone applications.

On Swipe you receive the following message, you don't need to do anything in it:

-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
}

When a user hits DELETE you can process it:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If row is deleted, remove it from the list.
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// delete your data item here
// Animate the deletion from the table.
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}

May 12, 2009

Andrei Alexandrescu: "Iteratos Must Go"

Very interesting slides of Andrei Alexandrescu from BOOSTCon'09, where he talks about ranges. I wish to be there in Aspen at the time when BOOSTCon took place. So, here you get the slides.