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

Commit

Permalink
Fix iOS 7.1 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
VivienCormier committed Mar 24, 2014
1 parent bf3aab2 commit f938a50
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
Expand Up @@ -26,10 +26,14 @@ - (void)viewDidLoad
//
self.myImage = [[UIImageViewModeScaleAspect alloc]initWithFrame:CGRectMake(0, 100, 200, 100)];
self.myImage.contentMode = UIViewContentModeScaleAspectFill; // Add the first contentMode
self.myImage.image = [UIImage imageNamed:@"becomeapanda_tumblr_com"];
self.myImage.image = [UIImage imageNamed:@"becomeapanda_tumblr_com_portrait"];
self.myImage.backgroundColor = [UIColor blackColor];
[self.view addSubview:_myImage];

//
// New : use to get the UIImage use [self.myImage getImage] instead of [self.myImage image]
//

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(animateImage)];
[self.view addGestureRecognizer:tap];
}
Expand Down
5 changes: 5 additions & 0 deletions UIImageViewModeScaleAspect/UIImageViewModeScaleAspect.h
Expand Up @@ -103,4 +103,9 @@
*/
- (void)animateFinishToScaleAspectFill;


- (UIImage *)getImage;

- (UIImage *)image __attribute((deprecated("use getImage method")));

@end
23 changes: 12 additions & 11 deletions UIImageViewModeScaleAspect/UIImageViewModeScaleAspect.m
Expand Up @@ -19,6 +19,8 @@ @interface UIImageViewModeScaleAspect ()

@implementation UIImageViewModeScaleAspect

@synthesize image = _image;

#pragma mark - Lifecycle

/**
Expand Down Expand Up @@ -273,6 +275,14 @@ - (void)animateFinishToScaleAspectFill{

}

#pragma mark - Getter

- (UIImage *)getImage{

return _img.image;

}

#pragma mark - Rewrite Setter / Getter

- (void)setImage:(UIImage *)image{
Expand All @@ -283,18 +293,9 @@ - (void)setImage:(UIImage *)image{

- (UIImage *)image{

NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];

NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]];
[array removeObject:@""];

if ([[array objectAtIndex:3] isEqualToString:@"<redacted>"]) {
return nil;
} else {
return _img.image;
}
// If you want the UIImage use "getImage"

return nil;
}

- (void)setContentMode:(UIViewContentMode)contentMode{
Expand Down

0 comments on commit f938a50

Please sign in to comment.