diff --git a/Vector/ViewController/RoomViewController.m b/Vector/ViewController/RoomViewController.m
index 8adfb6499..9a27c9f1e 100644
--- a/Vector/ViewController/RoomViewController.m
+++ b/Vector/ViewController/RoomViewController.m
@@ -170,7 +170,6 @@
// Prepare expanded header
self.expandedHeaderContainer.backgroundColor = kVectorColorLightGrey;
- self.expandedHeaderContainerHeightConstraint.constant = 240;
expandedHeader = [ExpandedRoomTitleView roomTitleView];
expandedHeader.delegate = self;
@@ -178,6 +177,13 @@
expandedHeader.translatesAutoresizingMaskIntoConstraints = NO;
[self.expandedHeaderContainer addSubview:expandedHeader];
// Force expanded header in full width
+ NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:expandedHeader
+ attribute:NSLayoutAttributeTop
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.expandedHeaderContainer
+ attribute:NSLayoutAttributeTop
+ multiplier:1.0
+ constant:0];
NSLayoutConstraint *leftConstraint = [NSLayoutConstraint constraintWithItem:expandedHeader
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
@@ -192,23 +198,8 @@
attribute:NSLayoutAttributeTrailing
multiplier:1.0
constant:0];
- // Vertical constraints are required for iOS > 8
- NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:expandedHeader
- attribute:NSLayoutAttributeTop
- relatedBy:NSLayoutRelationEqual
- toItem:self.expandedHeaderContainer
- attribute:NSLayoutAttributeTop
- multiplier:1.0
- constant:0];
- NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:expandedHeader
- attribute:NSLayoutAttributeBottom
- relatedBy:NSLayoutRelationEqual
- toItem:self.expandedHeaderContainer
- attribute:NSLayoutAttributeBottom
- multiplier:1.0
- constant:0];
- [NSLayoutConstraint activateConstraints:@[leftConstraint, rightConstraint, topConstraint, bottomConstraint]];
+ [NSLayoutConstraint activateConstraints:@[leftConstraint, rightConstraint, topConstraint]];
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(onSwipeGesture:)];
@@ -457,8 +448,10 @@
self.navigationItem.rightBarButtonItem.enabled = (self.roomDataSource != nil);
self.titleView.editable = NO;
-
+
+ // Force expanded header refresh
expandedHeader.mxRoom = self.roomDataSource.room;
+ self.expandedHeaderContainerHeightConstraint.constant = expandedHeader.bottomBorderView.frame.origin.y + 1;
// Restore tool bar view and room activities view if none
if (!self.inputToolbarView)
@@ -637,6 +630,12 @@
[self setRoomTitleViewClass:RoomTitleView.class];
((RoomTitleView*)self.titleView).tapGestureDelegate = self;
}
+ else
+ {
+ // Force expanded header refresh
+ expandedHeader.mxRoom = self.roomDataSource.room;
+ self.expandedHeaderContainerHeightConstraint.constant = expandedHeader.bottomBorderView.frame.origin.y + 1;
+ }
}
else
{
@@ -824,10 +823,6 @@
{
// Warn the user that the email is not bound to his matrix account
previewHeader.subInvitationLabel.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_preview_unlinked_email_warning", @"Vector", nil), roomPreviewData.emailInvitation.email];
-
- // room_preview_unlinked_email_warning is long long long and overlaps
- // bottomBorderView. So, hide this last one.
- previewHeader.bottomBorderView.hidden = YES;
}
}
diff --git a/Vector/ViewController/RoomViewController.xib b/Vector/ViewController/RoomViewController.xib
index 6f53d831e..953698105 100644
--- a/Vector/ViewController/RoomViewController.xib
+++ b/Vector/ViewController/RoomViewController.xib
@@ -33,10 +33,10 @@
-
+
-
+
diff --git a/Vector/Views/RoomTitle/ExpandedRoomTitleView.h b/Vector/Views/RoomTitle/ExpandedRoomTitleView.h
index 05bbea63a..6b9853e7c 100644
--- a/Vector/Views/RoomTitle/ExpandedRoomTitleView.h
+++ b/Vector/Views/RoomTitle/ExpandedRoomTitleView.h
@@ -21,6 +21,6 @@
@property (weak, nonatomic) IBOutlet UILabel *roomTopic;
@property (weak, nonatomic) IBOutlet UILabel *roomMembers;
-@property (weak, nonatomic) IBOutlet NSLayoutConstraint *roomMembersLabelTopConstraint;
+@property (weak, nonatomic) IBOutlet UIView *bottomBorderView;
@end
\ No newline at end of file
diff --git a/Vector/Views/RoomTitle/ExpandedRoomTitleView.m b/Vector/Views/RoomTitle/ExpandedRoomTitleView.m
index d56bc532c..206ce43dc 100644
--- a/Vector/Views/RoomTitle/ExpandedRoomTitleView.m
+++ b/Vector/Views/RoomTitle/ExpandedRoomTitleView.m
@@ -56,18 +56,6 @@
self.roomTopic.text = [MXTools stripNewlineCharacters:self.mxRoom.state.topic];
- // Adjust the position of the display name and the member status according to the presence of a room topic.
- if (self.roomTopic.text.length)
- {
- self.displayNameTextFieldTopConstraint.constant = 126;
- self.roomMembersLabelTopConstraint.constant = 203;
- }
- else
- {
- self.displayNameTextFieldTopConstraint.constant = 141;
- self.roomMembersLabelTopConstraint.constant = 193;
- }
-
// Compute active members count
NSArray *members = self.mxRoom.state.members;
NSUInteger activeCount = 0;
@@ -110,6 +98,9 @@
self.roomTopic.text = nil;
self.roomMembers.text = nil;
}
+
+ // Force the layout of subviews to update the position of 'bottomBorderView' which is used to define the actual height of the preview container.
+ [self layoutIfNeeded];
}
@end
diff --git a/Vector/Views/RoomTitle/ExpandedRoomTitleView.xib b/Vector/Views/RoomTitle/ExpandedRoomTitleView.xib
index 8222835a4..e9271696d 100644
--- a/Vector/Views/RoomTitle/ExpandedRoomTitleView.xib
+++ b/Vector/Views/RoomTitle/ExpandedRoomTitleView.xib
@@ -1,14 +1,14 @@
-
+
-
+
-
+
@@ -21,36 +21,37 @@
-
+
+
+
+
+
+
+
+
-
+
-
+
@@ -64,29 +65,33 @@
-
+
-
+
+
+
-
+
+
+
+
-
diff --git a/Vector/Views/RoomTitle/PreviewRoomTitleView.m b/Vector/Views/RoomTitle/PreviewRoomTitleView.m
index a48305571..e2d96ec59 100644
--- a/Vector/Views/RoomTitle/PreviewRoomTitleView.m
+++ b/Vector/Views/RoomTitle/PreviewRoomTitleView.m
@@ -199,6 +199,9 @@
self.roomTopic.text = nil;
self.invitationLabel.text = nil;
}
+
+ // Force the layout of subviews to update the position of 'bottomBorderView' which is used to define the actual height of the preview container.
+ [self layoutIfNeeded];
}
- (void)setRoomPreviewData:(RoomPreviewData *)roomPreviewData
diff --git a/Vector/Views/RoomTitle/PreviewRoomTitleView.xib b/Vector/Views/RoomTitle/PreviewRoomTitleView.xib
index 52801e2f8..7257f7b5c 100644
--- a/Vector/Views/RoomTitle/PreviewRoomTitleView.xib
+++ b/Vector/Views/RoomTitle/PreviewRoomTitleView.xib
@@ -9,7 +9,7 @@
-
+