From 745ce34ded4e6c3145cc596f15d0404e1d55d93d Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 13 Feb 2018 15:49:29 +0100 Subject: [PATCH] fix size of table view of chat room creations --- .../Base.lproj/ChatConversationCreateView.xib | 5 ++-- Classes/ChatConversationCreateTableView.h | 1 + Classes/ChatConversationCreateTableView.m | 27 ++++++++++--------- Classes/ChatsListView.m | 1 + 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Classes/Base.lproj/ChatConversationCreateView.xib b/Classes/Base.lproj/ChatConversationCreateView.xib index 49d7e3485..1ee9bac77 100644 --- a/Classes/Base.lproj/ChatConversationCreateView.xib +++ b/Classes/Base.lproj/ChatConversationCreateView.xib @@ -1,11 +1,11 @@ - + - + @@ -170,6 +170,7 @@ + diff --git a/Classes/ChatConversationCreateTableView.h b/Classes/ChatConversationCreateTableView.h index 0f7d1526c..e4e97087b 100644 --- a/Classes/ChatConversationCreateTableView.h +++ b/Classes/ChatConversationCreateTableView.h @@ -15,6 +15,7 @@ @property(nonatomic, strong) NSMutableArray *contactsGroup; @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; @property (weak, nonatomic) IBOutlet UIIconButton *controllerNextButton; +@property (weak, nonatomic) IBOutlet UIView *waitView; @property(nonatomic) Boolean isForEditing; - (void) loadData; diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index dbc31b879..2536ee3ad 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -33,6 +33,20 @@ return [[first.firstName lowercaseString] compare:[second.firstName lowercaseString]]; }]; + int y = _contactsGroup.count > 0 + ? _collectionView.frame.origin.y + _collectionView.frame.size.height + : _searchBar.frame.origin.y + _searchBar.frame.size.height; + [UIView animateWithDuration:0 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, + y, + self.tableView.frame.size.width, + _waitView.frame.size.height - _waitView.frame.origin.y - y)]; + } + completion:nil]; + _contacts = [[NSMutableDictionary alloc] initWithCapacity:_sortedAddresses.count]; if(_notFirstTime) { for(NSString *addr in _contactsGroup) { @@ -47,19 +61,6 @@ [_searchBar setText:@""]; [self searchBar:_searchBar textDidChange:_searchBar.text]; self.tableView.accessibilityIdentifier = @"Suggested addresses"; - if (_contactsGroup.count > 0) { - [UIView animateWithDuration:0 - delay:0 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, - _collectionView.frame.origin.y + _collectionView.frame.size.height, - self.tableView.frame.size.width, - self.tableView.frame.size.height - _collectionView.frame.size.height)]; - - } - completion:nil]; - } } - (void) viewWillDisappear:(BOOL)animated { diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m index 1967f1999..ca6ce435a 100644 --- a/Classes/ChatsListView.m +++ b/Classes/ChatsListView.m @@ -84,6 +84,7 @@ static UICompositeViewDescription *compositeDescription = nil; ChatConversationCreateView *view = VIEW(ChatConversationCreateView); view.isForEditing = false; view.tableController.notFirstTime = FALSE; + [view.tableController.contactsGroup removeAllObjects]; [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; }