From 274c5a551aa7b38e5e221e2b80e6f9a706cde7a6 Mon Sep 17 00:00:00 2001 From: questbeat Date: Mon, 6 Apr 2015 17:13:08 +0900 Subject: [PATCH] Refactoring --- QBImagePicker/QBAssetsViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 9f66dfdc..bf183eff 100755 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -112,8 +112,8 @@ - (void)setAssetsGroup:(ALAssetsGroup *)assetsGroup [self updateAssets]; - // Find previous selected item if needed - if ([self isAutoDeselectEnabled]) { + if ([self isAutoDeselectEnabled] && self.imagePickerController.selectedAssetURLs.count > 0) { + // Get index of previous selected asset NSURL *previousSelectedAssetURL = [self.imagePickerController.selectedAssetURLs firstObject]; [self.assets enumerateObjectsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop) { @@ -128,7 +128,7 @@ - (void)setAssetsGroup:(ALAssetsGroup *)assetsGroup [self.collectionView reloadData]; } -// + - (BOOL)isAutoDeselectEnabled { return (self.imagePickerController.maximumNumberOfSelection == 1