Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Fix for issues #59 and #78 #79

Closed
wants to merge 15 commits into from
Closed
8 changes: 4 additions & 4 deletions DZNPhotoPickerController.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@version = "1.6.1"
@version = "1.6.5"

Pod::Spec.new do |s|
s.name = "DZNPhotoPickerController"
Expand All @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.screenshots = "https://raw.githubusercontent.com/dzenbot/DZNPhotoPickerController/master/Docs/screenshots.png"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Ignacio Romero Z." => "[email protected]" }

s.source = { :git => "https://github.com/dzenbot/UIPhotoPickerController.git", :tag => "v#{s.version}" }

s.default_subspec = 'Core'
Expand All @@ -19,7 +19,7 @@ Pod::Spec.new do |s|

s.subspec 'Core' do |ss|
ss.source_files = 'Source/Classes/Core/*.{h,m}'
ss.dependency 'SDWebImage', '3.7'
ss.dependency 'SDWebImage', '3.7.1'
ss.dependency 'DZNEmptyDataSet', '1.3.3'
ss.dependency 'MBProgressHUD', '0.9'

Expand All @@ -40,5 +40,5 @@ Pod::Spec.new do |s|
ss.source_files = 'Source/Classes/Editor/*.{h,m}',
'Source/Classes/Core/DZNPhotoPickerControllerConstants.{h,m}'
end

end
1 change: 1 addition & 0 deletions Source/Classes/Core/DZNPhotoDisplayViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
Stops any loading HTTP request.
*/
- (void)stopLoadingRequest;
- (void)hideKeyboard;

@end
21 changes: 19 additions & 2 deletions Source/Classes/Core/DZNPhotoDisplayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ @implementation DZNPhotoDisplayViewController
@synthesize loadButton = _loadButton;
@synthesize activityIndicator = _activityIndicator;
@synthesize searchTimer = _searchTimer;
static bool showResult;

- (instancetype)init
{
Expand Down Expand Up @@ -519,7 +520,11 @@ - (void)selectedItemAtIndexPath:(NSIndexPath *)indexPath
[controller.activityIndicator startAnimating];

__weak DZNPhotoEditorViewController *_controller = controller;


// workaround for bug where image is blank when returning to the same image
// remove any previously cached image
[[SDImageCache sharedImageCache] removeImageForKey:[metadata.sourceURL absoluteString] fromDisk:NO];

[controller.imageView sd_setImageWithPreviousCachedImageWithURL:metadata.sourceURL
andPlaceholderImage:nil
options:SDWebImageCacheMemoryOnly|SDWebImageProgressiveDownload|SDWebImageRetryFailed
Expand Down Expand Up @@ -599,6 +604,9 @@ - (void)shouldSearchPhotos:(NSString *)keyword
if ((_previousService != _selectedService || _searchBar.text != keyword) && keyword.length > 1) {

_previousService = _selectedService;
showResult = YES;
[_searchBar becomeFirstResponder];
[_searchBar resignFirstResponder];
[self resetPhotos];
[self searchPhotosWithKeyword:keyword];
}
Expand Down Expand Up @@ -840,13 +848,22 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
showResult = NO;
[self stopLoadingRequest];
return YES;
}

- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
{
return YES;
if (showResult) {
return YES;
}else {
return NO;
}
}
- (void) hideKeyboard {
showResult = YES;
[_searchBar resignFirstResponder];
}

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
Expand Down
3 changes: 3 additions & 0 deletions Source/Classes/Core/DZNPhotoPickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,17 @@ - (void)cancelPicker:(id)sender
[controller stopLoadingRequest];
}

[controller hideKeyboard];
if (self.cancellationBlock) {
self.cancellationBlock(self);
return;
}

if (self.delegate && [self.delegate respondsToSelector:@selector(photoPickerControllerDidCancel:)]) {
[self.delegate photoPickerControllerDidCancel:self];
[self dismissViewControllerAnimated:YES completion:nil];
}

}


Expand Down
Loading