ソースを参照

1.相片更换到新的api

huangxiaodong 2 年 前
コミット
28116eb6c6

+ 0 - 8
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -145,8 +145,6 @@
 		6B05819F2AFCF4E800D37290 /* AJPhotoListView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B05819D2AFCF4E800D37290 /* AJPhotoListView.h */; };
 		6B0581A22AFCF50300D37290 /* AJPhotoListCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A02AFCF50300D37290 /* AJPhotoListCell.h */; };
 		6B0581A32AFCF50300D37290 /* AJPhotoListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A12AFCF50300D37290 /* AJPhotoListCell.m */; };
-		6B0581AA2AFCF57300D37290 /* AJGradientView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A42AFCF57200D37290 /* AJGradientView.h */; };
-		6B0581AB2AFCF57300D37290 /* AJGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A52AFCF57200D37290 /* AJGradientView.m */; };
 		6B0581AC2AFCF57300D37290 /* AJPhotoGroupCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */; };
 		6B0581AD2AFCF57300D37290 /* AJPhotoGroupView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */; };
 		6B0581AE2AFCF57300D37290 /* AJPhotoGroupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A82AFCF57300D37290 /* AJPhotoGroupView.m */; };
@@ -482,8 +480,6 @@
 		6B05819D2AFCF4E800D37290 /* AJPhotoListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoListView.h; sourceTree = "<group>"; };
 		6B0581A02AFCF50300D37290 /* AJPhotoListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoListCell.h; sourceTree = "<group>"; };
 		6B0581A12AFCF50300D37290 /* AJPhotoListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoListCell.m; sourceTree = "<group>"; };
-		6B0581A42AFCF57200D37290 /* AJGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJGradientView.h; sourceTree = "<group>"; };
-		6B0581A52AFCF57200D37290 /* AJGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJGradientView.m; sourceTree = "<group>"; };
 		6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoGroupCell.m; sourceTree = "<group>"; };
 		6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoGroupView.h; sourceTree = "<group>"; };
 		6B0581A82AFCF57300D37290 /* AJPhotoGroupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoGroupView.m; sourceTree = "<group>"; };
@@ -1108,8 +1104,6 @@
 		6B0581622AFCDB4300D37290 /* photoView */ = {
 			isa = PBXGroup;
 			children = (
-				6B0581A42AFCF57200D37290 /* AJGradientView.h */,
-				6B0581A52AFCF57200D37290 /* AJGradientView.m */,
 				6B0581A92AFCF57300D37290 /* AJPhotoGroupCell.h */,
 				6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */,
 				6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */,
@@ -1605,7 +1599,6 @@
 				18963B462AB84398006E7C50 /* GuideView.h in Headers */,
 				18A909982ABC4A3300E6D2BE /* ComontAlretViewController.h in Headers */,
 				186820192AB94877005702A6 /* GuideLastView.h in Headers */,
-				6B0581AA2AFCF57300D37290 /* AJGradientView.h in Headers */,
 				6B0581AD2AFCF57300D37290 /* AJPhotoGroupView.h in Headers */,
 				18F9CB072ABD7835003FF71A /* QRCodeScanForChangeDeviceViewController.h in Headers */,
 				18664FF62AC2B3A4008F8A61 /* ShearDeviceUDPManager.h in Headers */,
@@ -1967,7 +1960,6 @@
 				18E557222A3C5D75005CC84B /* CalculatorViewController.m in Sources */,
 				6BFF269A2AFA16DA00FCB4F7 /* forgetSecretKeyViewController.m in Sources */,
 				18E5572F2A3C6141005CC84B /* UITextfield+NLLimit.m in Sources */,
-				6B0581AB2AFCF57300D37290 /* AJGradientView.m in Sources */,
 				183AE6B72A8CA0C100B11CB0 /* ShowImageView.m in Sources */,
 				186820262AB9B5BF005702A6 /* SetPWDFirstViewController.m in Sources */,
 				A003F6F827D8775A00715CBF /* HWSearchBar.m in Sources */,

+ 3 - 1
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -22,6 +22,7 @@
 #import "connectDeviceManager.h"
 #import "mySetHeadView.h"
 #import "uploadImageOrVideoViewController.h"
+#import "TZImagePickerController.h"
 
 @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
 {
@@ -82,8 +83,9 @@
         if(tag ==2 || tag ==3){
             uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
             //vc.assetsFilter = [ALAssetsFilter allVideos];
-            vc.assetsFilter = [ALAssetsFilter allPhotos];
+            //vc.assetsFilter = [ALAssetsFilter allPhotos];
             [self.navigationController pushViewController:vc animated:YES];
+            
         }
     };
     

+ 0 - 18
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.h

@@ -1,18 +0,0 @@
-//
-//  AJGradientView.h
-//  AJPhotoPicker
-//
-//  Created by AlienJunX on 15/4/28.
-//  Copyright (c) 2015 AlienJunX
-//
-//  This source code is licensed under the MIT-style license found in the
-//  LICENSE file in the root directory of this source tree.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface AJGradientView : UIView
-
-- (void)setupCAGradientLayer:(NSArray *)colors locations:(NSArray *)locations;
-
-@end

+ 0 - 26
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.m

@@ -1,26 +0,0 @@
-//
-//  AJGradientView.m
-//  AJPhotoPicker
-//
-//  Created by AlienJunX on 15/4/28.
-//  Copyright (c) 2015 AlienJunX
-//
-//  This source code is licensed under the MIT-style license found in the
-//  LICENSE file in the root directory of this source tree.
-//
-
-#import "AJGradientView.h"
-
-@implementation AJGradientView
-
-+ (Class)layerClass {
-    return [CAGradientLayer class];
-}
-
-- (void)setupCAGradientLayer:(NSArray *)colors locations:(NSArray *)locations {
-    CAGradientLayer *gradient=(CAGradientLayer*)self.layer;
-    gradient.colors = colors;
-    gradient.locations = locations;
-}
-
-@end

+ 4 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.h

@@ -10,6 +10,7 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "TZImageManager.h"
 
 @class ALAssetsGroup;
 
@@ -18,8 +19,9 @@
 /**
  *  显示相册信息
  *
- *  @param assetsGroup 相册
+ *  @param model 相册
  */
-- (void)bind:(ALAssetsGroup *)assetsGroup;
+
+- (void)bindModel:(TZAlbumModel *)model;
 
 @end

+ 12 - 10
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.m

@@ -10,10 +10,9 @@
 //
 
 #import "AJPhotoGroupCell.h"
-#import <AssetsLibrary/AssetsLibrary.h>
 
 @interface AJPhotoGroupCell()
-@property (nonatomic, strong) ALAssetsGroup *assetsGroup;
+
 @property (nonatomic, strong) UIImageView *groupImageView;
 @property (nonatomic, strong) UILabel *groupTextLabel;
 @end
@@ -21,11 +20,14 @@
 
 @implementation AJPhotoGroupCell
 
-- (void)bind:(ALAssetsGroup *)assetsGroup{
-    self.assetsGroup = assetsGroup;
+- (void)bindModel:(TZAlbumModel *)model{
+  //  self.assetsGroup = assetsGroup;
     self.backgroundColor = [UIColor whiteColor];
     if (self.groupImageView == nil) {
         UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(14, 5, 50, 50)];
+        imageView.contentMode = UIViewContentModeScaleAspectFill;
+        imageView.layer.masksToBounds = YES;
+        //imageView.backgroundColor = [UIColor greenColor];
         [self.contentView addSubview:imageView];
         self.groupImageView = imageView;
     }
@@ -39,14 +41,14 @@
         self.groupTextLabel = textLabel;
     }
     
-    CGImageRef posterImage = assetsGroup.posterImage;
-    size_t height = CGImageGetHeight(posterImage);
-    float scale = height / 78.0f;
+    [[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {
+        self.groupImageView.image = postImage;
+        [self setNeedsLayout];
+    }];
     
-    self.groupImageView.image = [UIImage imageWithCGImage:posterImage scale:scale orientation:UIImageOrientationUp];
     
-    NSString *curStr1 = [NSString stringWithFormat:@"%@",[assetsGroup valueForProperty:ALAssetsGroupPropertyName]];
-    NSString *curStr2 = [NSString stringWithFormat:@"%ld",(long)[assetsGroup numberOfAssets]];
+    NSString *curStr1 = [NSString stringWithFormat:@"%@",model.name];
+    NSString *curStr2 = [NSString stringWithFormat:@"%ld",(long)model.count];
     NSString *totalStr = [[NSString alloc] initWithFormat:@"%@\n%@",curStr1,curStr2];
     
     NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];

+ 8 - 6
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.h

@@ -10,17 +10,21 @@
 //
 
 #import <UIKit/UIKit.h>
+#import <Photos/Photos.h>
+#import "TZImageManager.h"
+
 @class ALAssetsGroup;
 @class ALAssetsFilter;
 
+
 @protocol AJPhotoGroupViewProtocol <NSObject>
 
 /**
  *  选中相册
  *
- *  @param assetsGroup 相册
+ *  @param model 相册
  */
-- (void)didSelectGroup:(ALAssetsGroup *)assetsGroup;
+- (void)didSelectGroup:(TZAlbumModel *)model;
 
 @end
 
@@ -28,13 +32,11 @@
 @interface AJPhotoGroupView : UITableView
 //委托
 @property (weak, nonatomic) id<AJPhotoGroupViewProtocol> my_delegate;
-//过滤掉不现实的信息
-@property (nonatomic, strong) ALAssetsFilter *assetsFilter;
+
 //选中相册的索引
 @property (nonatomic) NSInteger selectIndex;
 
-@property (nonatomic, strong) NSMutableArray *groups;
-
+@property (nonatomic, strong) NSMutableArray *albumGroups;
 /**
  *  加载并显示相册
  */

+ 20 - 71
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.m

@@ -8,10 +8,8 @@
 
 #import "AJPhotoGroupView.h"
 #import "AJPhotoGroupCell.h"
-#import <AssetsLibrary/AssetsLibrary.h>
 
 @interface AJPhotoGroupView()<UITableViewDataSource,UITableViewDelegate>
-@property (nonatomic, strong) ALAssetsLibrary *assetsLibrary;
 
 @end
 
@@ -51,62 +49,24 @@
 }
 
 - (void)setupGroup {
-    [self.groups removeAllObjects];
+    [self.albumGroups removeAllObjects];
     
-    __block BOOL isAddAllType = NO;
-    ALAssetsLibraryGroupsEnumerationResultsBlock resultsBlock = ^(ALAssetsGroup *group, BOOL *stop) {
-        if (group) {
-            [group setAssetsFilter:self.assetsFilter];
-            if (group.numberOfAssets > 0 ){
-                if ([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupSavedPhotos){
-                    //[self.groups insertObject:group atIndex:0];
-                } else if ([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupPhotoStream && self.groups.count > 0){
-                    //[self.groups insertObject:group atIndex:1];
-                } else {
-                    
-                    if([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupAlbum){
-                        [self.groups addObject:group];
-                    }
-                    else{
-                        if(!isAddAllType){
-                            [self.groups insertObject:group atIndex:0];
-                            isAddAllType = YES;
-                        }
-                        
-                    }
-                    
-                   
-                    //HLog(@"%@ === %ld",group,[[group valueForProperty:ALAssetsGroupPropertyType] intValue]);
-                }
-            }
-        } else {
-            [self dataReload];
-        }
-    };
-    
-    ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError *error) {
-        //没权限
-        [self showNotAllowed];
-    };
-    
-    //显示的相册
-    NSUInteger type = ALAssetsGroupSavedPhotos | ALAssetsGroupPhotoStream |
-    ALAssetsGroupLibrary | ALAssetsGroupAlbum | ALAssetsGroupEvent |
-    ALAssetsGroupFaces  ;
-    
-    [self.assetsLibrary enumerateGroupsWithTypes:type
-                                      usingBlock:resultsBlock
-                                    failureBlock:failureBlock];
+    [[TZImageManager manager] getAllAlbums:NO allowPickingImage:YES needFetchAssets:NO completion:^(NSArray<TZAlbumModel *> *models) {
+        
+        self->_albumGroups = [[NSMutableArray alloc] initWithArray:models];
+        [self dataReload];
+    }];
+
 }
 
 #pragma mark - Reload Data
 - (void)dataReload {
-    if (self.groups.count == 0)
+    if (self.albumGroups.count == 0)
         //没有图片
         [self showNoAssets];
     
-    if (self.groups.count >0 && [_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
-        [_my_delegate didSelectGroup:self.groups[0]];
+    if (self.albumGroups.count >0 && [_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
+        [_my_delegate didSelectGroup:self.albumGroups[0]];
     }
     [self reloadData];
 }
@@ -132,7 +92,8 @@
         cell = [[AJPhotoGroupCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifer];
     }
     
-    [cell bind:[self.groups objectAtIndex:indexPath.row]];
+    [cell bindModel:[self.albumGroups objectAtIndex:indexPath.row]];
+
     if (indexPath.row == self.selectIndex) {
         cell.backgroundColor = [UIColor hwColor:@"#EEFBFF" alpha:1.0];
         cell.selectButton.selected = YES;
@@ -141,7 +102,8 @@
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return self.groups.count;
+    //return self.groups.count;
+    return self.albumGroups.count;
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -152,31 +114,18 @@
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
     self.selectIndex = indexPath.row;
     [self reloadData];
-    ALAssetsGroup *group = [self.groups objectAtIndex:indexPath.row];
+    TZAlbumModel *model = [self.albumGroups objectAtIndex:indexPath.row];
     if ([_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
-        [_my_delegate didSelectGroup:group];
+        [_my_delegate didSelectGroup:model];
     }
 }
 
 #pragma mark - getter/setter
-- (NSMutableArray *)groups {
-    if (!_groups) {
-        _groups = [[NSMutableArray alloc] init];
-    }
-    return _groups;
-}
-
-#pragma mark - ALAssetsLibrary
-- (ALAssetsLibrary *)assetsLibrary {
-    if (!_assetsLibrary) {
-        static dispatch_once_t pred = 0;
-        static ALAssetsLibrary *library = nil;
-        dispatch_once(&pred, ^{
-            library = [[ALAssetsLibrary alloc] init];
-        });
-        _assetsLibrary = library;
+- (NSMutableArray *)albumGroups {
+    if (!_albumGroups) {
+        _albumGroups = [[NSMutableArray alloc] init];
     }
-    return _assetsLibrary;
+    return _albumGroups;
 }
 
 @end

+ 4 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.h

@@ -10,6 +10,8 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "TZImageManager.h"
+
 @class ALAsset;
 
 @interface AJPhotoListCell : UICollectionViewCell
@@ -17,11 +19,11 @@
 /**
  *  显示照片
  *
- *  @param asset           照片
+ *  @param model           照片
  *  @param selectionFilter 过滤器
  *  @param isSelected YES选中,NO取消选中
  */
-- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected;
+- (void)bind:(TZAssetModel *)model selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected;
 
 
 /**

+ 10 - 37
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.m

@@ -11,18 +11,17 @@
 
 #import "AJPhotoListCell.h"
 #import <AssetsLibrary/AssetsLibrary.h>
-#import "AJGradientView.h"
+
 
 @interface AJPhotoListCell()
 @property (strong, nonatomic) UIImageView *imageView;
-@property (strong, nonatomic) ALAsset *asset;
-@property (strong, nonatomic) AJGradientView *gradientView;
+
 @end
 
 @implementation AJPhotoListCell
 
-- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected {
-    self.asset = asset;
+- (void)bind:(TZAssetModel *)model selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected {
+    
     if (self.imageView == nil) {
         UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
         [self.contentView addSubview:imageView];
@@ -34,39 +33,13 @@
         self.backgroundColor = [UIColor whiteColor];
     }
     
-
+    int32_t imageRequestID = [[TZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.frame.size.width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
+        // Set the cell's thumbnail image if it's still showing the same asset.
+        self.imageView.image = photo;
+        [self setNeedsLayout];
+        
+    } progressHandler:nil networkAccessAllowed:NO];
     
-    if ([asset isKindOfClass:[UIImage class]]) {
-        [self.imageView setImage:(UIImage *)asset];
-    } else {
-        [self.imageView setImage:[UIImage imageWithCGImage:asset.aspectRatioThumbnail]];
-        if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypeVideo) {
-            if (!self.gradientView) {
-                AJGradientView *gradientView = [[AJGradientView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
-                [self.contentView insertSubview:gradientView aboveSubview:self.imageView];
-                self.gradientView = gradientView;
-                [self.gradientView setupCAGradientLayer:@[(id)[[UIColor clearColor] colorWithAlphaComponent:0.0f].CGColor, (id)[[UIColor colorWithRed:23.0/255.0 green:22.0/255.0 blue:22.0/255.0 alpha:1.0] colorWithAlphaComponent:0.8f].CGColor] locations:@[@0.8f,@1.0f]];
-                
-                //icon
-                UIImageView *videoIcon = [[UIImageView alloc] initWithFrame:CGRectMake(5, self.bounds.size.height-15, 15, 8)];
-                videoIcon.image = [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BoPhotoPicker.bundle/images/AssetsPickerVideo@2x.png"]];
-                [self.gradientView addSubview:videoIcon];
-                
-                //duration
-                UILabel *duration = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(videoIcon.frame), self.bounds.size.height-17, self.bounds.size.width-CGRectGetMaxX(videoIcon.frame)-5, 12)];
-                duration.font = [UIFont systemFontOfSize:12];
-                duration.textColor = [UIColor whiteColor];
-                duration.textAlignment = NSTextAlignmentRight;
-                duration.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-                [self.gradientView addSubview:duration];
-                
-                double value = [[asset valueForProperty:ALAssetPropertyDuration] doubleValue];
-                duration.text = [self timeFormatted:value];
-            }
-        } else {
-            [self.gradientView removeFromSuperview];
-        }
-    }
     
     if (self.selectButton == nil) {
         UIButton *but = [[UIButton alloc] init];

+ 1 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.h

@@ -7,6 +7,7 @@
 
 #import "BaseViewController.h"
 #import <AssetsLibrary/AssetsLibrary.h>
+#import "TZImageManager.h"
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 25 - 33
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -174,7 +174,7 @@
  */
 - (void)setupGroupView {
     AJPhotoGroupView *photoGroupView = [[AJPhotoGroupView alloc] init];
-    photoGroupView.assetsFilter = self.assetsFilter;
+    //photoGroupView.assetsFilter = self.assetsFilter;
     photoGroupView.my_delegate = self;
     [self.view insertSubview:photoGroupView belowSubview:self.navBarBGView];
     self.photoGroupView = photoGroupView;
@@ -183,11 +183,17 @@
     
     [self.photoGroupView setupGroup];
     
+    NSInteger maxCount = 6;
+    
+    if(self.photoGroupView.albumGroups.count < maxCount){
+        maxCount = self.photoGroupView.albumGroups.count;
+    }
+    
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         [photoGroupView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.mas_equalTo(0);
             make.right.mas_equalTo(0);
-            make.height.mas_equalTo(60.0*self.photoGroupView.groups.count);
+            make.height.mas_equalTo(60.0 * maxCount);
             make.top.equalTo(self.navBarBGView.mas_bottom).offset(0.f);
         }];
     });
@@ -207,7 +213,10 @@
         self.bgMaskView.hidden = NO;
         self.photoGroupView.hidden = NO;
         [UIView animateWithDuration:0.3 animations:^{
-            //self.photoGroupView.transform = CGAffineTransformMakeTranslation(0, 360);
+            CGRect rect = self.photoGroupView.frame;
+            rect.origin.y = CGRectGetMaxY(self.navBarBGView.frame);
+            self.photoGroupView.frame = rect;
+            
             self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
         }];
     } else {
@@ -219,7 +228,10 @@
     //[self.bgMaskView removeFromSuperview];
     self.bgMaskView.hidden = YES;
     [UIView animateWithDuration:0.3 animations:^{
-        //self.photoGroupView.transform = CGAffineTransformIdentity;
+        CGRect rect = self.photoGroupView.frame;
+        rect.origin.y = -SCREEN_H;
+        self.photoGroupView.frame = rect;
+        
         self.selectTip.transform = CGAffineTransformIdentity;
     }completion:^(BOOL finished) {
         self.photoGroupView.hidden = YES;
@@ -260,43 +272,23 @@
 
 
 #pragma mark - BoPhotoGroupViewProtocol
-- (void)didSelectGroup:(ALAssetsGroup *)assetsGroup {
-    [self loadAssets:assetsGroup];
-    [self setTitleLabelText:[assetsGroup valueForProperty:ALAssetsGroupPropertyName]];
+- (void)didSelectGroup:(TZAlbumModel *)model {
+    [self loadAssets:model];
+    [self setTitleLabelText:model.name];
     [self hidenGroupView];
 }
 
 //加载图片
-- (void)loadAssets:(ALAssetsGroup *)assetsGroup {
+- (void)loadAssets:(TZAlbumModel *)model {
     [self.indexPathsForSelectedItems removeAllObjects];
     [self.assets removeAllObjects];
     
-    //相机cell
-    NSMutableArray *tempList = [[NSMutableArray alloc] init];
-    //默认第一个为相机按钮
-    //[tempList addObject:[UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BoPhotoPicker.bundle/images/BoAssetsCamera@2x.png"]]];
-    
-    ALAssetsGroupEnumerationResultsBlock resultsBlock = ^(ALAsset *asset, NSUInteger index, BOOL *stop) {
-        if (asset) {
-            [tempList addObject:asset];
-        } else if (tempList.count > 0) {
-            //排序
-            NSArray *sortedList = [tempList sortedArrayUsingComparator:^NSComparisonResult(ALAsset *first, ALAsset *second) {
-                if ([first isKindOfClass:[UIImage class]]) {
-                    return NSOrderedAscending;
-                }
-                id firstData = [first valueForProperty:ALAssetPropertyDate];
-                id secondData = [second valueForProperty:ALAssetPropertyDate];
-                return [secondData compare:firstData];//降序
-            }];
-            [self.assets addObjectsFromArray:sortedList];
-            
-            [self.photoListView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
-            [self.photoListView reloadData];
-        }
-    };
+    [[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray<TZAssetModel *> *models) {
+        self->_assets = [NSMutableArray arrayWithArray:models];
+        [self.photoListView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
+        [self.photoListView reloadData];
+    }];
     
-    [assetsGroup enumerateAssetsUsingBlock:resultsBlock];
 }
 
 #pragma mark - uicollectionDelegate