From 71a1978d6e392634eb0ca621df1a065f2d1dc531 Mon Sep 17 00:00:00 2001 From: dmcBig Date: Fri, 15 Jun 2018 11:59:57 +0800 Subject: [PATCH] add album list view --- src/ios/DMCMediaPicker/AlbumListView.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ios/DMCMediaPicker/AlbumListView.m b/src/ios/DMCMediaPicker/AlbumListView.m index 57b33b5..b51d80e 100644 --- a/src/ios/DMCMediaPicker/AlbumListView.m +++ b/src/ios/DMCMediaPicker/AlbumListView.m @@ -48,6 +48,13 @@ _dataNameSource=names; _nowIndex=nowIndex; [self.tableView reloadData]; + int scrolltoIndex=0; + if((int)_nowIndex>[_dataNameSource count]-4){ + scrolltoIndex= [_dataNameSource count]-1; + }else{ + scrolltoIndex=((int)_nowIndex+3); + } + [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForItem:scrolltoIndex inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; } @@ -70,6 +77,8 @@ CGFloat margin=20; UIImageView *cellImageView = [[UIImageView alloc]initWithFrame:CGRectMake(margin, 10, _cellHeight-20, _cellHeight-20)]; cellImageView.backgroundColor = [UIColor brownColor]; + cellImageView.contentMode=UIViewContentModeScaleAspectFill; + cellImageView.clipsToBounds=YES; cellImageView.tag = 101; [cell addSubview:cellImageView]; @@ -79,7 +88,7 @@ } if(_nowIndex==indexPath.item){ - cell.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:0.2f]; + cell.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:0.13f]; }else{ cell.backgroundColor=[UIColor whiteColor]; } @@ -94,6 +103,7 @@ options:nil resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) { UIImageView *cellImageView = (UIImageView *)[cell viewWithTag:101]; + cellImageView.image = result; //标题 UILabel *cellText = (UILabel *)[cell viewWithTag:102];