Fix iOS11 disruption

- RoomViewController, RoomDetailsVC, ContactDetailsVC: fix header layout.
- Use UIScrollView+MatrixKit category to handle the adjusted content inset which is not defined before iOS 11.
This commit is contained in:
Giom Foret
2017-09-27 09:26:34 +02:00
parent bf09483d4d
commit b8c576ef18
18 changed files with 270 additions and 153 deletions
@@ -33,7 +33,7 @@
#define TABLEVIEW_SECTION_HEADER_HEIGHT 28
#define TABLEVIEW_SECTION_HEADER_HEIGHT_WHEN_HIDDEN 0.01f
@interface RoomMemberDetailsViewController ()
@interface RoomMemberDetailsViewController () <RoomMemberTitleViewDelegate>
{
RoomMemberTitleView* memberTitleView;
@@ -118,18 +118,18 @@
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
memberTitleView = [RoomMemberTitleView roomMemberTitleView];
memberTitleView.delegate = self;
if (@available(iOS 11.0, *))
{
// Define directly the navigation titleView with the custom title view instance. Do not use anymore a container.
memberTitleView = [RoomMemberTitleView roomMemberTitleView];
self.navigationItem.titleView = memberTitleView;
}
else
{
self.navigationItem.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 40)];
memberTitleView = [RoomMemberTitleView roomMemberTitleView];
// Add the title view and define edge constraints
memberTitleView.translatesAutoresizingMaskIntoConstraints = NO;
[self.navigationItem.titleView addSubview:memberTitleView];
@@ -336,7 +336,8 @@
}
}
if (memberTitleView)
// Check whether the title view has been created and rendered.
if (memberTitleView && memberTitleView.superview)
{
// Adjust the header height by taking into account the actual position of the member avatar in title view
// This position depends automatically on the screen orientation.
@@ -1060,4 +1061,11 @@
}
}
#pragma mark - RoomMemberTitleViewDelegate
- (void)roomMemberTitleViewDidLayoutSubview:(RoomMemberTitleView*)titleView
{
[self viewDidLayoutSubviews];
}
@end