//
// ViewController.m
// iOS体验
//
// Created by liyuhong165 on 17/6/23.
// Copyright © 2017年 lyh. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *img;
@end
@implementation ViewController
#pragma mark 1.打电话、发短信(需要真机测试)
/*
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSURL *url = [NSURL URLWithString:@"tel://10010"]; // sms 发短信
[[UIApplication sharedApplication] openURL:url];
}
*/
#pragma mark 2.过度动画
/*
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// 创建一个多度动画
CATransition *anima = [CATransition animation];
// 设置动画类型
anima.type = @"cube";
// 设置动画时间
anima.duration = 5;
// 添加动画
[self.view.layer addAnimation:anima forKey:nil];
}
*/
#pragma mark 3.全景动画
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// 1.将所有的图片保存起来
NSMutableArray *arrM = [NSMutableArray array];
for(int i = 1;i < 36;i++)
{
// 拼接所有图片名称
NSString *name = [NSString stringWithFormat:@"img_360car_black_%02d",i];
[arrM addObject:[UIImage imageNamed:name]];
}
// 2.将图片设置给图片容器
self.img.animationImages = arrM;
self.img.animationDuration = 5;
self.img.animationRepeatCount = 1;
// 3.执行动画
[self.img startAnimating];
}
@end