Closed jozdee closed 5 months ago
(void)showBrowserWithIndex:(NSInteger)index { NSMutableArray photos = [NSMutableArray new]; [self.dataSource enumerateObjectsUsingBlock:^(GKTimeLineModel model, NSUInteger idx, BOOL _Nonnull stop) { GKChatViewCell cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0]]; GKTimeLineImage *img = model.images.firstObject;
GKPhoto *photo = [GKPhoto new]; photo.url = [NSURL URLWithString:img.url]; photo.sourceImageView = cell.imgView; if (img.isVideo) { photo.videoUrl = [NSURL URLWithString:img.video_url]; photo.autoPlay = NO; } // 首次点击的是视频,自动播放 if (img.isVideo && index == idx) { photo.isVideoClicked = YES; } [photos addObject:photo];
}];
GKPhotoBrowser *browser = [GKPhotoBrowser photoBrowserWithPhotos:photos currentIndex:index]; browser.showStyle = GKPhotoBrowserShowStyleZoom; browser.hideStyle = GKPhotoBrowserHideStyleZoomScale; browser.hidesPageControl = YES; browser.hidesSavedBtn = YES; browser.hidesCountLabel = YES; browser.delegate = self; browser.isSingleTapDisabled = YES; browser.isVideoPausedWhenDragged = NO; [browser setupVideoProgressProtocol:[GKVideoProgressView new]]; browser.isVideoReplay = NO; [browser showFromVC:self]; }
已添加
(void)showBrowserWithIndex:(NSInteger)index { NSMutableArray photos = [NSMutableArray new]; [self.dataSource enumerateObjectsUsingBlock:^(GKTimeLineModel model, NSUInteger idx, BOOL _Nonnull stop) { GKChatViewCell cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0]]; GKTimeLineImage *img = model.images.firstObject;
}];
GKPhotoBrowser *browser = [GKPhotoBrowser photoBrowserWithPhotos:photos currentIndex:index]; browser.showStyle = GKPhotoBrowserShowStyleZoom; browser.hideStyle = GKPhotoBrowserHideStyleZoomScale; browser.hidesPageControl = YES; browser.hidesSavedBtn = YES; browser.hidesCountLabel = YES; browser.delegate = self; browser.isSingleTapDisabled = YES; browser.isVideoPausedWhenDragged = NO; [browser setupVideoProgressProtocol:[GKVideoProgressView new]]; browser.isVideoReplay = NO; [browser showFromVC:self]; }
pragma mark - GKPhotoBrowserDelegate