博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UIVIew相关知识
阅读量:6008 次
发布时间:2019-06-20

本文共 2543 字,大约阅读时间需要 8 分钟。

hot3.png

title: UIView 相关知识

date: 2015-12-13 22:47
categories: IOS

tags: UIView

我的博客:

masonry 添加约束,并修改约束添加View动画

//添加约束masView = [UIView new];masView.backgroundColor = [UIColor redColor];[self.view addSubview:masView];[masView mas_makeConstraints:^(MASConstraintMaker *make) {    make.leading.equalTo(self.view).offset(20);//距离self.view左侧20    make.top.equalTo(self.view).offset(200);//距离self.view顶部200    make.width.offset(80);//宽度80    make.height.offset(80);//高度80}];//更新约束并添加动画,如果更新不成功可尝试 mas_remakeConstraints[masView mas_updateConstraints:^(MASConstraintMaker *make) {    make.width.and.height.offset(100);    make.leading.equalTo(self.view).offset(100);}];[UIView animateWithDuration:3 animations:^{    [self.view layoutIfNeeded];}];

uiview 圆角设置

m_mainImgView.layer.cornerRadius = 6;m_mainImgView.layer.masksToBounds = YES;

UIView缩放动画

-(void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views{    /* 为新添的annotationView添加弹出动画. */    for (UIView *view in views)    {        [self addBounceAnnimationToView:view];    }}/* annotation弹出的动画. */- (void)addBounceAnnimationToView:(UIView *)view{    CAKeyframeAnimation *bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];        bounceAnimation.values = @[@(0.05), @(1.1), @(0.9), @(1)];    bounceAnimation.duration = 0.6;        NSMutableArray *timingFunctions = [[NSMutableArray alloc] initWithCapacity:bounceAnimation.values.count];    for (NSUInteger i = 0; i < bounceAnimation.values.count; i++)    {        [timingFunctions addObject:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];    }    [bounceAnimation setTimingFunctions:timingFunctions.copy];        bounceAnimation.removedOnCompletion = NO;        [view.layer addAnimation:bounceAnimation forKey:@"bounce"];}

边框阴影

- (void)viewDidLoad  {      [self.view setBackgroundColor:[UIColor whiteColor]];      UIView *shadowView=[[UIView alloc] initWithFrame:CGRectMake(100, 100, 120, 120)];      [shadowView setBackgroundColor:[UIColor grayColor]];      [shadowView.layer setCornerRadius:4.0f];//设置View圆角      [shadowView.layer setShadowColor:[UIColor blackColor].CGColor];//设置View的阴影颜色      [shadowView.layer setShadowOpacity:0.8f];//设置阴影的透明度      [shadowView.layer setOpacity:0.5f];//设置View的透明度      [shadowView.layer setShadowOffset:CGSizeMake(4.0, 3.0)];//设置View Shadow的偏移量      [self.view addSubview:shadowView];      [super viewDidLoad];      // Do any additional setup after loading the view, typically from a nib.  }

转载于:https://my.oschina.net/coolwxb/blog/631319

你可能感兴趣的文章
个人总结
查看>>
uva 673 Parentheses Balance
查看>>
申请Let’s Encrypt免费证书,给自己网站增加https访问
查看>>
javascript+html 实现隐藏 显示
查看>>
BZOJ 2120 数颜色
查看>>
正则表达式学习笔记——基础知识
查看>>
织梦如何实现二级栏目导航的仿制
查看>>
网上购物系统(Task010)——FormView编辑更新商品详细信息
查看>>
Struts2 技术全总结 (正在更新)
查看>>
PowerShell_零基础自学课程_5_自定义PowerShell环境及Powershell中的基本概念
查看>>
Bzoj 2252: [2010Beijing wc]矩阵距离 广搜
查看>>
《编程之美》——寻找发帖“水王”学习与扩展 转surymj博客
查看>>
Linux 虚拟机VMware安装失败,提示没有选择磁盘
查看>>
LeetCode-Permutations
查看>>
SpringMVC的REST风格的四种请求方式
查看>>
漫谈 Clustering (1): k-means(转)
查看>>
从零搭建mongo分片集群的简洁方法
查看>>
J2EE环境配置与工具使用
查看>>
bzoj3684: 大朋友和多叉树(拉格朗日反演+多项式全家桶)
查看>>
C#整数三种强制类型转换int、Convert.ToInt32()、int.Parse()的区别
查看>>