美文网首页
iOS核心动画高级技巧02-图层树

iOS核心动画高级技巧02-图层树

作者: 属七降九 | 来源:发表于2017-04-16 23:33 被阅读0次

iOS 《CORE ANIMATION ADVANCED TECHNIQUES》 学习笔记

引入两个类拓展 UIView+LM.h 和 CALayer+LMXYWH.h
http://www.jianshu.com/p/03d38e6e25f9

#import "ViewController.h"

@interface ViewController ()
@property (strong,nonatomic)UIView *layerView;
@end

@implementation ViewController
#pragma mark - 控制器生命周期
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}
#pragma mark - setupUI
-(void)setupUI
{
    self.view.backgroundColor = [UIColor grayColor];
    
    self.layerView = [[UIView alloc]init];
    self.layerView.backgroundColor = [UIColor whiteColor];
    self.layerView.W = 200;
    self.layerView.H = 200;
    self.layerView.center = SCREEN_CENTER;
    [self.view addSubview:self.layerView];
    
    //给视图添加一个蓝色子视图
    CALayer *blueLayer = [CALayer layer];
    blueLayer.backgroundColor = [UIColor blueColor].CGColor;
    blueLayer.frame = CGRectMake(50, 50, 100, 100);
    [self.layerView.layer addSublayer:blueLayer];
}
@end
QQ20170416-232531.png

相关文章

网友评论

      本文标题:iOS核心动画高级技巧02-图层树

      本文链接:https://www.haomeiwen.com/subject/udezattx.html