Developer Area

Show
Ignore:
Timestamp:
09/16/11 16:55:43 (3 years ago)
Author:
henri
Message:

Added support for removing contacts from Superbook

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • apps/iphone/superbook/trunk/Classes/LocateThem_ViewController.m

    r899 r902  
    480480 
    481481- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 
    482     if (indexPath.section == LTSectionVisited) 
    483         return YES; 
    484     return NO; 
     482    return YES; 
    485483} 
    486484 
    487485- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 
    488     NSInteger maxRows = [domainsLastVisited numberOfCachedLookups]; 
    489     if ((indexPath.row == lastVisitedRowCount) && (lastVisitedRowCount < maxRows)) { 
    490         return UITableViewCellEditingStyleNone;     // See More row 
     486    if (indexPath.section == LTSectionVisited) { 
     487        NSInteger maxRows = [domainsLastVisited numberOfCachedLookups]; 
     488        if ((indexPath.row == lastVisitedRowCount) && (lastVisitedRowCount < maxRows)) { 
     489            return UITableViewCellEditingStyleNone;     // See More row 
     490        } 
    491491    } 
    492492    return UITableViewCellEditingStyleDelete; 
     
    494494 
    495495- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
    496     if ([domainsLastVisited deleteCachedDataForRow:[indexPath row]]) { 
    497         lastVisitedRowCount--; 
    498         [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    499         if ([tableView numberOfRowsInSection:indexPath.section] == 0) { 
    500             [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; 
    501         } 
     496    [tableView beginUpdates]; 
     497    if (indexPath.section == LTSectionVisited) { 
     498        if ([domainsLastVisited deleteCachedDataForRow:[indexPath row]]) { 
     499            lastVisitedRowCount--; 
     500        } 
     501    } else if (indexPath.section == LTSectionContacts) { 
     502        [[FriendsData sharedInstance] removeTelAtIndexPath:indexPath]; 
     503    } 
     504    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
     505    [tableView endUpdates]; 
     506    if ([tableView numberOfRowsInSection:indexPath.section] == 0) { 
     507        [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; 
    502508    } 
    503509} 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us