//卡类的头文件
#import "OWCardView.h"
@implementation OWCardView;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.layer.contents = (id) [UIImage imageNamed:@"4.png"].CGImage;
self.layer.shadowColor = [UIColor whiteColor].CGColor;
self.layer.shadowOpacity = 0.3;
}
return self;
}
- (void) moveCard:(float)xPoint along:(float)yPoint
{
CGRect someRect = CGRectMake(xPoint, yPoint, 72, 96);
[UIView animateWithDuration: 3.5
delay: 0.3
options: UIViewAnimationCurveEaseOut
animations: ^{ self.frame = someRect;}
completion: ^(BOOL finished) { }];
}
@end
// part of the Implementation in the view controller's viewDidLoad
[...]
CGRect myImageRect = CGRectMake(20.0f, 20.0f, 72.0f, 96.0f); …Run Code Online (Sandbox Code Playgroud)