mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Add scroll to page helper to ASPagerNode
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
@property (weak, nonatomic) id<ASPagerNodeDataSource> dataSource;
|
@property (weak, nonatomic) id<ASPagerNodeDataSource> dataSource;
|
||||||
|
|
||||||
|
- (void)scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@protocol ASPagerNodeDataSource <NSObject>
|
@protocol ASPagerNodeDataSource <NSObject>
|
||||||
|
|||||||
@@ -49,6 +49,14 @@
|
|||||||
[self setTuningParameters:renderParams forRangeType:ASLayoutRangeTypeRender];
|
[self setTuningParameters:renderParams forRangeType:ASLayoutRangeTypeRender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Helpers
|
||||||
|
|
||||||
|
- (void)scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated
|
||||||
|
{
|
||||||
|
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0];
|
||||||
|
[self.view scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:animated];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - ASCollectionViewDataSource
|
#pragma mark - ASCollectionViewDataSource
|
||||||
|
|
||||||
- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath
|
- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
|||||||
Reference in New Issue
Block a user