Position和anchorPoint
Main.storyboard
ViewController.m
//
// ViewController.m
// 7A12.position和anchorPoint
//
// Created by huan on 16/2/4.
// Copyright © 2016年 huanxi. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//创建一个图层
CALayer *layer = [CALayer layer];
layer.backgroundColor = [UIColor redColor].CGColor;
layer.bounds = CGRectMake(0, 0, 100, 100);
//图层的透明度
layer.opacity = 0.5;
//设置位置
layer.position = CGPointMake(100, 100);
//设置锚点
layer.anchorPoint = CGPointMake(0.5, 0.5);
//然后添加到控制器view的图层
[self.view.layer addSublayer:layer];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
结果
转载于:https://www.cnblogs.com/Lu2015-10-03/p/5191200.html
Position和anchorPoint相关推荐
- 从 CALayer 的 Position、AnchorPoint 说起
本文 demo 地址 有的东西虽然基础,但是耐不住人老记性差呀,自己写下来好过次次再搜咯,so...... AnchorPoint 和 Position AnchorPoint anchorPoint ...
- IOS笔记CALayer的position和anchorPoint
IOS笔记CALayer的position和anchorPoint CALayer有2个非常重要的属性:position和anchorPoint @property CGPoint position; ...
- 彻底理解position与anchorPoint - Wonderffee's Blog(转)
引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置? CALayer的position点是哪一点呢? anchorPoint与posi ...
- 48.iOS动画和理解position与anchorPoint
1.动画的基本概念 动画的使⽤场景:iOS中的动画是指一些视图上的过渡效果,合理利用动画能提⾼用户体验,UIView动画影响的属性 frame:视图框架 center:视图位置 alpha:视图透明度 ...
- 彻底理解position与anchorPoint
引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置? CALayer的position点是哪一点呢? anchorPoint与posi ...
- IOS开发之——Position和AnchorPoint(92)
一 概述 CAlayer中position和anchorPoint属性说明 position和anchorPoint示意图 二 position和anchorPoint属性说明 CALayer中有2个 ...
- position与anchorPoint理解(一)
转自 彻底理解position与anchorPoint 关于CALayer和UIView的介绍请移步:CALayer与UIView的关系 每一个UIView内部都默认关联着一个CALayer, UIV ...
- position和anchorPoint(掌握)
CALayer有两个非常重要的属性:position和anchorPoint @property CGPoint position; 用来设置CALayer在父层中的位置 以父层的左上角为原点(0,0 ...
- 彻底理解CALayer的position与anchorPoint
引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置? CALayer的position点是哪一点呢? anchorPoint与p ...
最新文章
- 使用Response.Redirect 两种方法打开一个新窗口
- ajax的数据库,AJAX 数据库
- ios开发中遇到的文件和字符的问题大总结
- 2019ICPC(银川) - Delivery Route(强连通缩点+分块最短路)
- type=file文件上传H5新特性
- java学习(108):StringBuilder连接字符串和删除操作
- JAVA8中Set排序四种写法
- 新手小白之学习python一飞冲天日志之—基本数据类型,条件控制语句
- 如何在 Mac 上下载 macOS Monterey public beta 6?
- 冒泡排序满分代码(C语言),附源代码,可直接运行
- 有什么视频翻译软件?这些软件值得收藏
- ffmpeg 中av_rescale_rnd 与av_rescale ()(AVRounding结构体)
- 这个数据库神器真是太diao了
- 马斯克发起投票:是否应该出售特斯拉10%的股票?超5成粉丝赞成
- android 遥控器home键键值,android 中遥控器键值的添加和修改
- mysql中ddl是什么_MySQL中DDL是什么意思
- 如何在2022年建立自己的NFT市场平台
- [P1726]上白泽慧音
- 计算机附件计算器的用法,计算机附件中计算器使用方法.doc
- 从P1到P7——我在淘宝这7年
热门文章
- tasklist命令参数应用详细图解
- 电力管理信息系统数据库表总结
- Struts2中的action类
- matlab如何读取未知行数,带头文件和字段名的txt文件
- ubuntu命令安装jdk
- 银行加速“去房地产化”
- python 预编译命令_Python子进程调用预编译j
- kettle连接不上es7_kettle8.2连接ElasticSearch7
- java模态_java – 如何在另一个模态JDialog之上创建一个模态的JDialog
- 【Paper】2021_Observer-based distributed consensus for multi-agent systems with directed networks and