ViewController.m#
// 时针练习
//
// Created by lanou3g on 15/12/23.
// Copyright © 2015年 lanou3g. All rights reserved.
//
/**
//以下是基本的四种效果
kCATransitionPush 推入效果
kCATransitionMoveIn 移入效果
kCATransitionReveal 截开效果
kCATransitionFade 渐入渐出效果
//以下API效果可以安全使用
cube 方块
suckEffect 三角
rippleEffect 水波抖动
pageCurl 上翻页
pageUnCurl 下翻页
oglFlip 上下翻转
cameraIrisHollowOpen 镜头快门开
cameraIrisHollowClose 镜头快门开
// 以下API效果请慎用
spewEffect 新版面在屏幕下方中间位置被释放出来覆盖旧版面.
genieEffect 旧版面在屏幕左下方或右下方被吸走, 显示出下面的新版面
unGenieEffect 新版面在屏幕左下方或右下方被释放出来覆盖旧版面.
twist 版面以水平方向像龙卷风式转出来.
tubey 版面垂直附有弹性的转出来.
swirl 旧版面360度旋转并淡出, 显示出新版面.
charminUltra 旧版面淡出并显示新版面.
zoomyIn 新版面由小放大走到前面, 旧版面放大由前面消失.
zoomyOut 新版面屏幕外面缩放出现, 旧版面缩小消失.
oglApplicationSuspend 像按”home” 按钮的效果.
*/
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIView *hourView;//时针
@property (weak, nonatomic) IBOutlet UIView *minuteView;//分针
@property (weak, nonatomic) IBOutlet UIView *secondView;//秒针
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//锚点
_secondView.layer.position = CGPointMake(202, 250);
_secondView.layer.anchorPoint = CGPointMake(0, 0.5);
_minuteView.layer.position = CGPointMake(202, 250);
_minuteView.layer.anchorPoint = CGPointMake(0, 0.5);
_hourView.layer.position = CGPointMake(202, 250);
_hourView.layer.anchorPoint = CGPointMake(0, 0.5);
//
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeTime) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(changeTime1) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval:3600 target:self selector:@selector(changeTime2) userInfo:nil repeats:YES];
}
-(void)changeTime{
_secondView.layer.transform = CATransform3DRotate(_secondView.layer.transform, M_PI/30, 0, 0,1);
}
-(void)changeTime1{
_minuteView.layer.transform = CATransform3DRotate(_minuteView.layer.transform, M_PI/30, 0, 0, 1);
}
-(void)changeTime2{
_hourView.layer.transform = CATransform3DRotate(_hourView.layer.transform, M_PI/6, 0, 0, 1);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end