From 270abb78beee959796d594a694e5d4645de6e489 Mon Sep 17 00:00:00 2001 From: REIS Benjamin Date: Thu, 20 Oct 2016 11:33:56 +0200 Subject: [PATCH] fix UI issues --- Classes/ContactDetailsView.h | 1 + Classes/ContactDetailsView.m | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Classes/ContactDetailsView.h b/Classes/ContactDetailsView.h index d134c5cc3..7bd78ded1 100644 --- a/Classes/ContactDetailsView.h +++ b/Classes/ContactDetailsView.h @@ -39,6 +39,7 @@ @property(weak, nonatomic) IBOutlet UIToggleButton *deleteButton; @property(weak, nonatomic) IBOutlet UIScrollView *contentView; @property(weak, nonatomic) IBOutlet UILabel *emptyLabel; +@property BOOL isAdding; - (IBAction)onBackClick:(id)event; - (IBAction)onCancelClick:(id)event; diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 4fc1d9b96..673537d19 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -121,6 +121,7 @@ } - (void)newContact { + _isAdding = TRUE; [self selectContact:[[Contact alloc] initWithPerson:ABPersonCreate()] andReload:YES]; } @@ -284,18 +285,20 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Action Functions - (IBAction)onCancelClick:(id)event { - if (_contact.phoneNumbers.count + _contact.sipAddresses.count > 0 && (_contact.firstName != NULL || _contact.lastName != NULL)) { - [self setEditing:FALSE]; - [self resetData]; - } else { - _emptyLabel.hidden = NO; + [self setEditing:FALSE]; + [self resetData]; + + if (IPAD) { + _emptyLabel.hidden = !_isAdding; _avatarImage.hidden = !_emptyLabel.hidden; _deleteButton.hidden = !_emptyLabel.hidden; _editButton.hidden = !_emptyLabel.hidden; - if (!IPAD) { + } else { + if (_isAdding) { [PhoneMainView.instance popCurrentView]; } } + _isAdding = FALSE; } - (IBAction)onBackClick:(id)event { @@ -311,6 +314,7 @@ static UICompositeViewDescription *compositeDescription = nil; if (_tableController.isEditing) { [self setEditing:FALSE]; [self saveData]; + _isAdding = FALSE; } else { [self setEditing:TRUE]; }