BugFix: Chat screen: the room title is missing in landscape mode on iPhone 6+

This commit is contained in:
giomfo
2016-02-22 10:36:31 +01:00
parent cfaede8064
commit 7bea9fe002
2 changed files with 41 additions and 11 deletions
+20 -5
View File
@@ -39,13 +39,28 @@
if (self.superview)
{
// Center horizontally the avatar according to the actual screen center
// Center horizontally the avatar into the navigation bar
CGRect frame = self.superview.frame;
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
UINavigationBar *navigationBar;
UIView *superView = self;
while (superView.superview)
{
if ([superView.superview isKindOfClass:[UINavigationBar class]])
{
navigationBar = (UINavigationBar*)superView.superview;
break;
}
superView = superView.superview;
}
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
self.roomAvatarCenterXConstraint.constant = (screenSize.width / 2) - superviewCenterX;
if (navigationBar)
{
CGSize navBarSize = navigationBar.frame.size;
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
self.roomAvatarCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
}
}
}
+21 -6
View File
@@ -55,14 +55,29 @@
if (self.superview)
{
// Center horizontally the display name according to the actual screen center
// Center horizontally the display name into the navigation bar
CGRect frame = self.superview.frame;
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
UINavigationBar *navigationBar;
UIView *superView = self;
while (superView.superview)
{
if ([superView.superview isKindOfClass:[UINavigationBar class]])
{
navigationBar = (UINavigationBar*)superView.superview;
break;
}
superView = superView.superview;
}
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
// Center the display name
self.displayNameCenterXConstraint.constant = (screenSize.width / 2) - superviewCenterX;
if (navigationBar)
{
CGSize navBarSize = navigationBar.frame.size;
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
// Center the display name
self.displayNameCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
}
}
}