-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// FlipView.h | ||
// CoreAnimation | ||
// | ||
// Created by 村上 幸雄 on 12/03/10. | ||
// Copyright (c) 2012年 ビッツ有限会社. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface FlipView : UIView | ||
|
||
@property (strong, nonatomic) UIImageView *imageView; | ||
@property (assign, nonatomic) BOOL isAtMark; | ||
@property (strong, nonatomic) UIImage *atmarkImage; | ||
@property (strong, nonatomic) UIImage *arrowImage; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// | ||
// FlipView.m | ||
// CoreAnimation | ||
// | ||
// Created by 村上 幸雄 on 12/03/10. | ||
// Copyright (c) 2012年 ビッツ有限会社. All rights reserved. | ||
// | ||
|
||
#import "FlipView.h" | ||
|
||
@interface FlipView () | ||
@end | ||
|
||
@implementation FlipView | ||
|
||
@synthesize imageView = _imageView; | ||
@synthesize isAtMark = _isAtMark; | ||
@synthesize atmarkImage = _atmarkImage; | ||
@synthesize arrowImage = _arrowImage; | ||
|
||
- (id)initWithFrame:(CGRect)frame | ||
{ | ||
DBGMSG(@"%s", __func__); | ||
self = [super initWithFrame:frame]; | ||
if (self) { | ||
// Initialization code | ||
} | ||
return self; | ||
} | ||
|
||
- (void)awakeFromNib | ||
{ | ||
DBGMSG(@"%s", __func__); | ||
self.isAtMark = YES; | ||
self.atmarkImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"atmark.png" ofType:nil]]; | ||
self.arrowImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"arrow.png" ofType:nil]]; | ||
self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(128.0, 176.0, 64.0, 64.0)]; | ||
self.imageView.image = self.atmarkImage; | ||
[self addSubview:self.imageView]; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
self.atmarkImage = nil; | ||
self.arrowImage = nil; | ||
} | ||
|
||
/* | ||
// Only override drawRect: if you perform custom drawing. | ||
// An empty implementation adversely affects performance during animation. | ||
- (void)drawRect:(CGRect)rect | ||
{ | ||
// Drawing code | ||
} | ||
*/ | ||
|
||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event | ||
{ | ||
[UIView beginAnimations:nil context:nil]; | ||
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft | ||
forView:self.imageView | ||
cache:YES]; | ||
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; | ||
[UIView setAnimationDuration:1.0]; | ||
if (self.isAtMark) { | ||
self.isAtMark = NO; | ||
self.imageView.image = self.arrowImage; | ||
|
||
} | ||
else { | ||
self.isAtMark = YES; | ||
self.imageView.image = self.atmarkImage; | ||
} | ||
[UIView commitAnimations]; | ||
} | ||
|
||
@end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters