From e2ab43b007925ea7ca7c58b785d9b884aa14e27b Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Thu, 3 Jan 2019 15:13:27 +0100 Subject: [PATCH] fix ContactDetailsView --- Classes/ContactDetailsView.m | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 5ff5b20cd..182f77b2d 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -247,6 +247,8 @@ } _cancelButton.hidden = TRUE; } + + [self recomputeTableViewSize:_editButton.hidden]; } - (void)viewWillDisappear:(BOOL)animated { @@ -360,23 +362,25 @@ static UICompositeViewDescription *compositeDescription = nil; _nameLabel.hidden = editing; [ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact]; - if ([self viewIsCurrentlyPortrait]) { - CGRect frame = _tableController.tableView.frame; - frame.origin.y = _avatarImage.frame.size.height + _avatarImage.frame.origin.y; - if (!editing) { - frame.origin.y += _nameLabel.frame.size.height; - } - - frame.size.height = _tableController.tableView.contentSize.height; - _tableController.tableView.frame = frame; - [self recomputeContentViewSize]; - } + [self recomputeTableViewSize:editing]; if (animated) { [UIView commitAnimations]; } } +- (void)recomputeTableViewSize:(BOOL)editing { + CGRect frame = _tableController.tableView.frame; + frame.origin.y = _avatarImage.frame.size.height + _avatarImage.frame.origin.y; + if ([self viewIsCurrentlyPortrait] && !editing) { + frame.origin.y += _nameLabel.frame.size.height; + } + + frame.size.height = _tableController.tableView.contentSize.height; + _tableController.tableView.frame = frame; + [self recomputeContentViewSize]; +} + - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change