UIVIew相关知识
2016-03-05 10:20
519 查看
title: UIView 相关知识
date: 2015-12-13 22:47
categories: IOS
我的博客:http://daycoding.com
date: 2015-12-13 22:47
categories: IOS
tags: UIView
小小程序猿我的博客:http://daycoding.com
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. }
相关文章推荐
- uitextview 相关知识
- uicollectionview cell 行间距、列间距
- UIViewController相关知识
- UITableView相关知识
- UIlabel相关知识
- UITableViewCell头文件学习
- UIWindow
- UINavigationController
- UIButton常用属性
- UIKit性能调优实战讲解
- bzoj 1670: [Usaco2006 Oct]Building the Moat护城河的挖掘
- 62. Unique Paths
- 60. Permutation Sequence
- NSData与UIImage之间的相互转换
- EasyUi的基础学习和总结
- ngRoute 和 ui.router 的使用方法和区别
- iOS学习—UIFont字体
- iOS UI设计---九宫格布局算法
- serialVersionUID 作用
- iOS UITableView使用练习 —— HERO博客