From 13d9a7f99d59317c18b0dd4bf94b39ce58ce727a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 15 Nov 2012 12:35:48 +0100 Subject: [PATCH] Hide remove button from contact edition if it is a new contact --- Classes/ContactDetailsTableViewController.m | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index d2e0ef476..74a47a6fe 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -588,10 +588,11 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_None, C - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { if(section == (ContactSections_MAX - 1)) { - return [footerController view]; - } else { - return nil; + if(ABRecordGetRecordID(contact) != kABRecordInvalidID) { + return [footerController view]; + } } + return nil; } - (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { @@ -619,9 +620,13 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_None, C } } -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { if(section == (ContactSections_MAX - 1)) { - return [UIContactDetailsFooter height:[footerController isEditing]]; + if(ABRecordGetRecordID(contact) != kABRecordInvalidID) { + return [UIContactDetailsFooter height:[footerController isEditing]]; + } else { + return 0.000001f; // Hack UITableView = 0 + } } else if(section == ContactSections_None) { return 0.000001f; // Hack UITableView = 0 }