Chat: Expanded header

Hide the header only on scroll down.
This commit is contained in:
giomfo
2016-02-10 12:25:40 +01:00
parent 7a9ac019da
commit 5b5679ebb6
+20 -6
View File
@@ -63,6 +63,9 @@
// The expanded header
ExpandedRoomTitleView *expandedHeader;
// The content offset at the beginning of scrolling
CGFloat storedContentOffset;
// The customized room data source for Vector
RoomDataSource *customizedRoomDataSource;
@@ -365,12 +368,6 @@
[super destroy];
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
// Hide the expanded header in case of scrolling
[self hideExpandedHeader:YES];
}
#pragma mark - Hide/Show expanded header
- (void)hideExpandedHeader:(BOOL)isHidden
@@ -1035,6 +1032,23 @@
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
// Store the current offset to detect scroll down
storedContentOffset = scrollView.contentOffset.y;
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
[super scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
// Hide expanded header on scroll down
if (storedContentOffset < scrollView.contentOffset.y)
{
[self hideExpandedHeader:YES];
}
}
#pragma mark - MXKRoomTitleViewDelegate
- (BOOL)roomTitleViewShouldBeginEditing:(MXKRoomTitleView*)titleView