diff --git a/LegacyComponents/TGAttachmentCarouselItemView.m b/LegacyComponents/TGAttachmentCarouselItemView.m index 26fe3f1357..729d79e07a 100644 --- a/LegacyComponents/TGAttachmentCarouselItemView.m +++ b/LegacyComponents/TGAttachmentCarouselItemView.m @@ -211,6 +211,9 @@ const NSUInteger TGAttachmentDisplayedAssetLimit = 500; } _collectionView = [[TGAttachmentCarouselCollectionView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, TGAttachmentZoomedPhotoHeight + TGAttachmentEdgeInset * 2) collectionViewLayout:_smallLayout]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _collectionView.backgroundColor = [UIColor clearColor]; _collectionView.dataSource = self; _collectionView.delegate = self; diff --git a/LegacyComponents/TGListsTableView.m b/LegacyComponents/TGListsTableView.m index 46cc95e7bc..f794727452 100644 --- a/LegacyComponents/TGListsTableView.m +++ b/LegacyComponents/TGListsTableView.m @@ -31,6 +31,8 @@ { _whiteFooterView = [[UIView alloc] init]; _whiteFooterView.backgroundColor = [UIColor whiteColor]; + //_whiteFooterView.layer.zPosition = -1.0; + _whiteFooterView.userInteractionEnabled = false; [self insertSubview:_whiteFooterView atIndex:0]; } } @@ -43,9 +45,12 @@ CGRect bounds = self.bounds; - if (_whiteFooterView != nil) + if (_whiteFooterView != nil) { _whiteFooterView.frame = CGRectMake(0.0f, MAX(0.0f, bounds.origin.y), bounds.size.width, bounds.size.height); - else + /*if (self.subviews.firstObject != _whiteFooterView) { + [self insertSubview:_whiteFooterView atIndex:0]; + }*/ + } else self.backgroundView.frame = CGRectMake(0.0f, MAX(0.0f, bounds.origin.y), bounds.size.width, bounds.size.height); if (_hackHeaderSize) @@ -71,6 +76,13 @@ } } +- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index { + if (index == 0 && view != _whiteFooterView) { + index = 1; + } + [super insertSubview:view atIndex:index]; +} + - (void)didAddSubview:(UIView *)subview { [super didAddSubview:subview]; diff --git a/LegacyComponents/TGMediaGroupsController.m b/LegacyComponents/TGMediaGroupsController.m index ecb4b3dbc2..e547878257 100644 --- a/LegacyComponents/TGMediaGroupsController.m +++ b/LegacyComponents/TGMediaGroupsController.m @@ -49,6 +49,9 @@ [super loadView]; _tableView = [[UITableView alloc] initWithFrame:self.view.bounds]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _tableView.alwaysBounceVertical = true; _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _tableView.backgroundColor = [UIColor whiteColor]; diff --git a/LegacyComponents/TGMediaPickerController.m b/LegacyComponents/TGMediaPickerController.m index c6a11c7784..13a724c2e4 100644 --- a/LegacyComponents/TGMediaPickerController.m +++ b/LegacyComponents/TGMediaPickerController.m @@ -55,6 +55,9 @@ [self.view addSubview:_wrapperView]; _collectionView = [[[self _collectionViewClass] alloc] initWithFrame:_wrapperView.bounds collectionViewLayout:[self _collectionLayout]]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _collectionView.alwaysBounceVertical = true; _collectionView.backgroundColor = [UIColor whiteColor]; _collectionView.delaysContentTouches = true; diff --git a/LegacyComponents/TGMediaPickerPhotoStripView.m b/LegacyComponents/TGMediaPickerPhotoStripView.m index cdccbe3e72..1ffdac6ab9 100644 --- a/LegacyComponents/TGMediaPickerPhotoStripView.m +++ b/LegacyComponents/TGMediaPickerPhotoStripView.m @@ -80,6 +80,9 @@ _collectionViewLayout.minimumLineSpacing = 4.0f; _collectionView = [[TGDraggableCollectionView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) collectionViewLayout:_collectionViewLayout]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _collectionView.alwaysBounceHorizontal = false; _collectionView.alwaysBounceVertical = false; _collectionView.backgroundColor = [UIColor clearColor]; diff --git a/LegacyComponents/TGMediaPickerSelectionGestureRecognizer.m b/LegacyComponents/TGMediaPickerSelectionGestureRecognizer.m index 1da02007ad..3cbb2503e6 100644 --- a/LegacyComponents/TGMediaPickerSelectionGestureRecognizer.m +++ b/LegacyComponents/TGMediaPickerSelectionGestureRecognizer.m @@ -23,6 +23,9 @@ const CGFloat TGSelectionGestureVerticalFailureThreshold = 5.0f; if (self != nil) { _collectionView = collectionView; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; _gestureRecognizer.delegate = self; diff --git a/LegacyComponents/TGModernConversationHashtagsAssociatedPanel.m b/LegacyComponents/TGModernConversationHashtagsAssociatedPanel.m index ac20e6491d..c4f4f3a836 100644 --- a/LegacyComponents/TGModernConversationHashtagsAssociatedPanel.m +++ b/LegacyComponents/TGModernConversationHashtagsAssociatedPanel.m @@ -75,6 +75,9 @@ [self addSubview:_bottomView]; _tableView = [[UITableView alloc] init]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _tableView.delegate = self; _tableView.dataSource = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; diff --git a/LegacyComponents/TGModernConversationMentionsAssociatedPanel.m b/LegacyComponents/TGModernConversationMentionsAssociatedPanel.m index b51be8b349..d64d123a80 100644 --- a/LegacyComponents/TGModernConversationMentionsAssociatedPanel.m +++ b/LegacyComponents/TGModernConversationMentionsAssociatedPanel.m @@ -87,6 +87,9 @@ [self addSubview:_tableViewBackground]; _tableView = [[UITableView alloc] init]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _tableView.delegate = self; _tableView.dataSource = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; diff --git a/LegacyComponents/TGNavigationBar.m b/LegacyComponents/TGNavigationBar.m index c798ed7ee1..081f77d2d9 100644 --- a/LegacyComponents/TGNavigationBar.m +++ b/LegacyComponents/TGNavigationBar.m @@ -324,14 +324,22 @@ static id _musicPlayerProvider; } } +- (bool)isBackgroundView:(UIView *)view { + NSString *viewClass = NSStringFromClass([view class]); + if ([viewClass isEqualToString:@"_UINavigationBarBackground"] || [viewClass isEqualToString:@"_UIBarBackground"]) { + return true; + } + return false; +} + - (UIView *)findBackground:(UIView *)view { if (view == nil) return nil; - NSString *viewClass = NSStringFromClass([view class]); - if ([viewClass isEqualToString:@"_UINavigationBarBackground"] || [viewClass isEqualToString:@"_UIBarBackground"]) + if ([self isBackgroundView:view]) { return view; + } for (UIView *subview in view.subviews) { @@ -355,8 +363,18 @@ static id _musicPlayerProvider; } } +- (void)addSubview:(UIView *)view { + if ([self isBackgroundView:view]) { + view.hidden = true; + } + [super addSubview:view]; +} + - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index { + if ([self isBackgroundView:view]) { + view.hidden = true; + } if (view != self.additionalView) [super insertSubview:view atIndex:MIN((int)self.subviews.count, MAX(index, 2))]; else diff --git a/LegacyComponents/TGNavigationController.m b/LegacyComponents/TGNavigationController.m index 59bc261c37..180737be0f 100644 --- a/LegacyComponents/TGNavigationController.m +++ b/LegacyComponents/TGNavigationController.m @@ -95,6 +95,12 @@ { [super loadView]; + if (iosMajorVersion() >= 11) { +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + self.navigationBar.prefersLargeTitles = false; +#endif + } + if (false && iosMajorVersion() >= 8) { SEL selector = NSSelectorFromString(TGEncodeText(@"`tdsffoFehfQboHftuvsfSfdphoj{fs", -1)); if ([self respondsToSelector:selector]) diff --git a/LegacyComponents/TGPhotoStickersView.m b/LegacyComponents/TGPhotoStickersView.m index d0f3711fa3..820b6c7c1d 100644 --- a/LegacyComponents/TGPhotoStickersView.m +++ b/LegacyComponents/TGPhotoStickersView.m @@ -182,6 +182,9 @@ typedef enum { _collectionLayout = [[TGPhotoStickersCollectionLayout alloc] init]; _collectionView = [[TGPhotoStickersCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_collectionLayout]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _collectionView.delegate = self; _collectionView.dataSource = self; _collectionView.backgroundColor = [UIColor clearColor]; diff --git a/LegacyComponents/TGStickerKeyboardTabPanel.m b/LegacyComponents/TGStickerKeyboardTabPanel.m index ded2ad6013..4b7865a894 100644 --- a/LegacyComponents/TGStickerKeyboardTabPanel.m +++ b/LegacyComponents/TGStickerKeyboardTabPanel.m @@ -53,6 +53,9 @@ _collectionLayout = [[UICollectionViewFlowLayout alloc] init]; _collectionLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height) collectionViewLayout:_collectionLayout]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; +#endif _collectionView.delegate = self; _collectionView.dataSource = self; _collectionView.backgroundColor = nil;