add category for imageView disolve transition

Change-Id: I25ca4ab5d69b129e08544a27d4d27f7cde90baed
This commit is contained in:
Siqi LIU
2013-07-31 15:13:11 +02:00
parent 89133bbf19
commit abfddb3899
4 changed files with 56 additions and 3 deletions

View File

@@ -51,6 +51,7 @@
57DF0A85178FFFAB008B2D3D /* iPhone_autosize.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57DF0A83178FFFAB008B2D3D /* iPhone_autosize.storyboard */; };
57FE71E31785C61400B50125 /* pinValidation_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E21785C61400B50125 /* pinValidation_vc.m */; };
57FE71E917861A9000B50125 /* slideShowPreviewTable_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E817861A9000B50125 /* slideShowPreviewTable_vc.m */; };
8C0323AB17A943720037432E /* UIImageView+setImageAnimated.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C0323AA17A943720037432E /* UIImageView+setImageAnimated.m */; };
8C0DC83A17A4177C0099E5AE /* nextButton_pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C0DC83617A4177C0099E5AE /* nextButton_pressed.png */; };
8C0DC83B17A4177C0099E5AE /* nextButton_pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C0DC83717A4177C0099E5AE /* nextButton_pressed@2x.png */; };
8C0DC83C17A4177C0099E5AE /* previousButton_pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C0DC83817A4177C0099E5AE /* previousButton_pressed.png */; };
@@ -151,6 +152,8 @@
57FE71E21785C61400B50125 /* pinValidation_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pinValidation_vc.m; path = iosremote/Communication/pinValidation_vc.m; sourceTree = "<group>"; };
57FE71E717861A9000B50125 /* slideShowPreviewTable_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slideShowPreviewTable_vc.h; sourceTree = "<group>"; };
57FE71E817861A9000B50125 /* slideShowPreviewTable_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = slideShowPreviewTable_vc.m; sourceTree = "<group>"; };
8C0323A917A943720037432E /* UIImageView+setImageAnimated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImageView+setImageAnimated.h"; path = "iosremote/UIImageView+setImageAnimated.h"; sourceTree = "<group>"; };
8C0323AA17A943720037432E /* UIImageView+setImageAnimated.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+setImageAnimated.m"; path = "iosremote/UIImageView+setImageAnimated.m"; sourceTree = "<group>"; };
8C0DC83617A4177C0099E5AE /* nextButton_pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = nextButton_pressed.png; sourceTree = "<group>"; };
8C0DC83717A4177C0099E5AE /* nextButton_pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "nextButton_pressed@2x.png"; sourceTree = "<group>"; };
8C0DC83817A4177C0099E5AE /* previousButton_pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = previousButton_pressed.png; sourceTree = "<group>"; };
@@ -419,6 +422,8 @@
8C26E5CF17A58703007DA4B7 /* HorizontalSlideCell.m */,
8C26E5D517A68154007DA4B7 /* stopWatch.h */,
8C26E5D617A68154007DA4B7 /* stopWatch.m */,
8C0323A917A943720037432E /* UIImageView+setImageAnimated.h */,
8C0323AA17A943720037432E /* UIImageView+setImageAnimated.m */,
);
name = Support;
sourceTree = "<group>";
@@ -635,6 +640,7 @@
8C26E5C917A5731D007DA4B7 /* autoDismissKeyboardNavigationViewController.m in Sources */,
8C26E5D017A58703007DA4B7 /* HorizontalSlideCell.m in Sources */,
8C26E5D717A68154007DA4B7 /* stopWatch.m in Sources */,
8C0323AB17A943720037432E /* UIImageView+setImageAnimated.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -10,6 +10,7 @@
#import "SlideShow.h"
#import "Base64.h"
#import "slideShow_vc_iphone.h"
#import "UIImageView+setImageAnimated.h"
#import <dispatch/dispatch.h>
@interface SlideShow()
@@ -90,7 +91,7 @@ NSLock *dictLock;
// image = [image resizedImage:view.frame.size interpolationQuality:kCGInterpolationDefault];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Setting image to tag: %ld", (long)[tag integerValue]);
[(UIImageView *)view setImage:image];
[(UIImageView *)view setImage:image animated:YES];
});
[self.loadBuffer removeObjectForKey:tag];
}
@@ -108,9 +109,8 @@ NSLock *dictLock;
UIImage *image = [self.imagesDictionary objectForKey:[self.loadBuffer objectForKey:tag]];
if (image){
UIImageView *imageView = (UIImageView *)[view viewWithTag:1];
// image = [image resizedImage:imageView.frame.size interpolationQuality:kCGInterpolationDefault];
dispatch_async(dispatch_get_main_queue(), ^{
[imageView setImage:image];
[imageView setImage:image animated:YES];
});
[self.loadBuffer removeObjectForKey:tag];
}

View File

@@ -0,0 +1,16 @@
//
// NSObject+UIImageView_setImageAnimated.h
// iosremote
//
// Created by Siqi Liu on 7/31/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UIImageView (setImageAnimated)
- (void) setImage:(UIImage *)image animated:(BOOL) animated Duration:(double)duration;
- (void) setImage:(UIImage *)image animated:(BOOL) animated;
@end

View File

@@ -0,0 +1,31 @@
//
// NSObject+UIImageView_setImageAnimated.m
// iosremote
//
// Created by Siqi Liu on 7/31/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import "UIImageView+setImageAnimated.h"
@implementation UIImageView (setImageAnimated)
- (void) setImage:(UIImage *)image animated:(BOOL) animated Duration:(double)duration
{
if (animated) {
[UIView transitionWithView:self
duration:duration
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
self.image = image;
} completion:nil];
} else
[self setImage:image];
}
- (void) setImage:(UIImage *)image animated:(BOOL) animated
{
[self setImage:image animated:animated Duration:0.5];
}
@end