Chat: Bug Fix - Adjust text message position when username is hidden.

This commit is contained in:
giomfo 2016-01-14 16:16:28 +01:00
parent 54bb3eff40
commit 4b33c93bdf
4 changed files with 78 additions and 0 deletions

View file

@ -27,4 +27,26 @@
self.userNameLabel.textColor = VECTOR_TEXT_BLACK_COLOR;
}
- (void)render:(MXKCellData *)cellData
{
[super render:cellData];
if (self.userNameLabel.isHidden)
{
// Adjust the top constraint of the message text view (This constraint is restored at the end of cell use see [didEndDisplay]).
self.msgTextViewTopConstraint.constant -= self.userNameLabel.frame.size.height;
}
}
- (void)didEndDisplay
{
// Restore the top constraint of the message text view if it has been modified during rendering
if (self.userNameLabel.isHidden)
{
self.msgTextViewTopConstraint.constant += self.userNameLabel.frame.size.height;
}
[super didEndDisplay];
}
@end

View file

@ -34,10 +34,27 @@
{
[super render:cellData];
if (self.userNameLabel.isHidden)
{
// Adjust the top constraint of the message text view (This constraint is restored at the end of cell use see [didEndDisplay]).
self.msgTextViewTopConstraint.constant -= self.userNameLabel.frame.size.height;
}
if (self.bubbleData)
{
self.paginationLabel.text = [[self.bubbleData.eventFormatter dateStringFromDate:self.bubbleData.date withTime:NO] uppercaseString];
}
}
- (void)didEndDisplay
{
// Restore the top constraint of the message text view if it has been modified during rendering
if (self.userNameLabel.isHidden)
{
self.msgTextViewTopConstraint.constant += self.userNameLabel.frame.size.height;
}
[super didEndDisplay];
}
@end

View file

@ -28,4 +28,26 @@
self.userNameLabel.textColor = VECTOR_TEXT_BLACK_COLOR;
}
- (void)render:(MXKCellData *)cellData
{
[super render:cellData];
if (self.userNameLabel.isHidden)
{
// Adjust the top constraint of the message text view (This constraint is restored at the end of cell use see [didEndDisplay]).
self.msgTextViewTopConstraint.constant -= self.userNameLabel.frame.size.height;
}
}
- (void)didEndDisplay
{
// Restore the top constraint of the message text view if it has been modified during rendering
if (self.userNameLabel.isHidden)
{
self.msgTextViewTopConstraint.constant += self.userNameLabel.frame.size.height;
}
[super didEndDisplay];
}
@end

View file

@ -35,10 +35,27 @@
{
[super render:cellData];
if (self.userNameLabel.isHidden)
{
// Adjust the top constraint of the message text view (This constraint is restored at the end of cell use see [didEndDisplay]).
self.msgTextViewTopConstraint.constant -= self.userNameLabel.frame.size.height;
}
if (self.bubbleData)
{
self.paginationLabel.text = [[self.bubbleData.eventFormatter dateStringFromDate:self.bubbleData.date withTime:NO] uppercaseString];
}
}
- (void)didEndDisplay
{
// Restore the top constraint of the message text view if it has been modified during rendering
if (self.userNameLabel.isHidden)
{
self.msgTextViewTopConstraint.constant += self.userNameLabel.frame.size.height;
}
[super didEndDisplay];
}
@end