99#import " GKTestViewController.h"
1010#import " GKTest02ViewCell.h"
1111#import " GKBottomView.h"
12-
1312#import " GKPhotoBrowser.h"
1413
1514@interface GKTestViewController ()<UITableViewDataSource, UITableViewDelegate, GKPhotoBrowserDelegate>
@@ -22,6 +21,8 @@ @interface GKTestViewController ()<UITableViewDataSource, UITableViewDelegate, G
2221
2322@property (nonatomic , strong ) UIPanGestureRecognizer *panGesture;
2423
24+ @property (nonatomic , weak ) GKPhotoBrowser *browser;
25+
2526@end
2627
2728@implementation GKTestViewController
@@ -33,12 +34,12 @@ - (void)viewDidLoad {
3334 self.view .backgroundColor = [UIColor whiteColor ];
3435
3536
36- GKBottomView *btmView = [GKBottomView new ];
37- btmView.frame = CGRectMake (0 , 100 , self.view .frame .size .width , 100 );
38- [self .view addSubview: btmView];
39- // [self setupView];
40- //
41- // [self setupData];
37+ // GKBottomView *btmView = [GKBottomView new];
38+ // btmView.frame = CGRectMake(0, 100, self.view.frame.size.width, 100);
39+ // [self.view addSubview:btmView];
40+ [self setupView ];
41+
42+ [self setupData ];
4243}
4344
4445- (void )setupView {
@@ -54,7 +55,12 @@ - (void)setupView {
5455
5556- (void )setupData {
5657
57- self.dataSource = @[@[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536686&di=aa91a60dfb4f9f762f58bb4513f9ef64&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F50da81cb39dbb6fd493c67e70024ab18962b378f.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=3b472d84a7801f2fd48afaa4f041fadb&imgtype=0&src=http%3A%2F%2Fb.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F0824ab18972bd40704fe413d72899e510fb30930.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=18fcb83dcc07f87aefbf58e8538ed4d8&imgtype=0&src=http%3A%2F%2Fg.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fd1160924ab18972b22abd40aefcd7b899f510a59.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=b40f1593ca5f51f64c8f8670598e79a2&imgtype=0&src=http%3A%2F%2Fg.hiphotos.baidu.com%2Fimage%2Fcrop%253D0%252C0%252C1024%252C654%2Fsign%3Dafc45f018b025aafc77d248bc6dd8754%2F838ba61ea8d3fd1f3fe3bbfb394e251f94ca5f0c.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=a47731fce0273aae3ddeb03d89fc273b&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb7003af33a87e950f0e956ad19385343faf2b471.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=121d9ff529f2d9807970f965aeca6c0f&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F241f95cad1c8a7861cb6a3ce6e09c93d71cf5056.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536685&di=a82dd1f57162599367340d0b5a9ece74&imgtype=0&src=http%3A%2F%2Fa.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fae51f3deb48f8c546c9162ee33292df5e1fe7fb5.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536684&di=22258dd90dec8f57bdeea79f8c17b04f&imgtype=0&src=http%3A%2F%2Fc.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F0d338744ebf81a4c1393d808de2a6059242da649.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509084536684&di=16dfed673e74c9e5f1c53e02700ab174&imgtype=0&src=http%3A%2F%2Fe.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fd058ccbf6c81800a6d5592cfb83533fa838b47ba.jpg"]
58+ self.dataSource = @[@[@" http://p1.music.126.net/9k3CAPfB9WdcMCFk4CYnKQ==/109951167793871917.jpg?imageView&quality=89" ,
59+ @" http://p1.music.126.net/GK7JvutM88U4ZkohN71TKQ==/109951167794081491.jpg?imageView&quality=89" ,
60+ // @"http://p1.music.126.net/QywPBMy3VK-P-wk_eYjrZw==/109951167793910298.jpg?imageView&quality=89",
61+ // @"http://p1.music.126.net/c4vOjlBA5bQsmpuASPi5QQ==/109951167794545716.jpg?imageView&quality=89",
62+ // @"http://p1.music.126.net/4ryVvqlvXp0Kh_fcxCWMsA==/109951166903789195.jpg?param=140y140",
63+ @" http://p1.music.126.net/gZWQbChzhCbGFXtpin2MXw==/109951167592864239.jpg?param=140y140" ]
5864 ];
5965
6066 [self .tableView reloadData ];
@@ -89,11 +95,25 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
8995 // browser.currentIndex = index;
9096 browser.showStyle = GKPhotoBrowserShowStyleZoom;
9197 browser.hideStyle = GKPhotoBrowserHideStyleZoomScale;
92- [browser setupCoverViews: @[self .coverView] layoutBlock: ^(GKPhotoBrowser * _Nonnull photoBrowser, CGRect superFrame) {
93- self.coverView .frame = CGRectMake (0 , 200 , superFrame.size .width , 100 );
98+ browser.isFollowSystemRotation = YES ;
99+ browser.addNavigationController = YES ;
100+
101+ UIButton *btn = [[UIButton alloc ] init ];
102+ [btn setImage: [UIImage imageNamed: @" cm2_list_detail_icn_cmt" ] forState: UIControlStateNormal];
103+ [btn sizeToFit ];
104+
105+ [btn addTarget: self action: @selector (btnClick ) forControlEvents: UIControlEventTouchUpInside];
106+
107+ [browser setupCoverViews: @[btn] layoutBlock: ^(GKPhotoBrowser * _Nonnull photoBrowser, CGRect superFrame) {
108+ CGRect frame = btn.frame ;
109+ frame.origin .x = superFrame.size .width - frame.size .width - 30 ;
110+ frame.origin .y = superFrame.size .height - frame.size .height - 30 ;
111+ btn.frame = frame;
94112 }];
95113
114+ browser.delegate = self;
96115 [browser showFromVC: self ];
116+ self.browser = browser;
97117 };
98118
99119 return cell;
@@ -110,6 +130,18 @@ - (void)pangesture:(UIPanGestureRecognizer *)pan {
110130
111131}
112132
133+ - (void )btnClick {
134+ UIViewController *vc = [[UIViewController alloc ] init ];
135+ vc.view .backgroundColor = UIColor.grayColor ;
136+ [self .browser.navigationController setNavigationBarHidden: NO ];
137+ [self .browser.navigationController pushViewController: vc animated: YES ];
138+ }
139+
140+ #pragma mark - GKPhotoBrowserDelegate
141+ - (void )photoBrowser : (GKPhotoBrowser *)browser didDisappearAtIndex : (NSInteger )index {
142+
143+ }
144+
113145#pragma mark - 懒加载
114146- (UIView *)coverView {
115147 if (!_coverView) {
0 commit comments