I’m developping an app using iOS5 and Xcode 4.3.3.
I have a UserTableViewController which is a TableViewController created by using CustomCell which is a subclass of UITableViewCell. So far, Everything is working just fine.
I also implemented these two methods to get user swipes. For now, i’m able to show delete button when user swipes .
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSDictionary *dictionaryWithUrl = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"Urls" ofType:@"plist"]];
NSString *baseUrl = [dictionaryWithUrl objectForKey:@"urlWithNews"];
baseUrl = [baseUrl stringByAppendingFormat:@"/delete?newsId=%d",[[[self.arrayWithUserNews objectAtIndex:indexPath.row]objectForKey:@"newsId" ]intValue]];
NSURLRequest *requestToDeleteNews = [NSURLRequest requestWithURL:[NSURL URLWithString:baseUrl]];
[NSURLConnection sendSynchronousRequest:requestToDeleteNews returningResponse:nil error:nil];
[self.arrayWithUserNews removeObjectAtIndex:indexPath.row ] ;
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView reloadData];
}
}
Well,what i want to do is recreate a custom cell,after swiping to have another functionalities. Because,for the app i’m developping, it’s not enough to delete a cell. User can edit a table cell as well. Here is an example,what i do want to create . This’s Twitter iOS Application example.They did what exactly i needed.
Initial cell

After user swipe

Attention,just to be clear,they appear exactly the same location.
Is there anybody who can give me the right path to accomplish this ?
Thank you.
Check out this project
It does exactly what u want