美文网首页
iOS App的切图

iOS App的切图

作者: 不吃鸡爪 | 来源:发表于2016-08-16 23:30 被阅读65次

切图中需要注意的几点
1.可重复元素:当背景图是可重复的纹理图案时

元素
UIColor *circleColorPattern = [UIColor colorWithPatternImage:
                               [UIImage imageNamed:@"love"]];

可以得到一个颜色模板,用这个颜色画或者填充某个区域的时候,模板图片会在指定的区域内平铺,如

纹理图案

2.某个图片从中间拉伸

UIImage *raImg = [UIImage imageNamed:@"SenderTextNodeBkg"];
int raW = raImg.size.width/2;
int raH = raImg.size.height/2;
[raImg resizableImageWithCapInsets:UIEdgeInsetsMake(raH, raW, raH, raW) resizingMode:UIImageResizingModeStretch];

UIImageView *raImgv = [[UIImageView alloc]initWithImage:raImg];
raImgv.frame = CGRectMake(10, 100, 200, 300);
[self.view addSubview:raImgv];

用于mask遮罩效果的图片配合resizableImage使用

遮罩.gif
//背景图
UIImage *img = [UIImage imageNamed:@"bj.jpg"];
UIImageView *imgv = [[UIImageView alloc]initWithImage:img];
imgv.frame = CGRectMake(0, 0, imgv.frame.size.width/3, imgv.frame.size.height/3);
imgv.center = self.view.center;
[self.view addSubview:imgv];

//mask Image
UIImage *maskImg = [UIImage imageNamed:@"mb"];
int wM = maskImg.size.width/2;
int hM = maskImg.size.height/2;
[maskImg resizableImageWithCapInsets:UIEdgeInsetsMake(hM, wM, hM, wM) resizingMode:UIImageResizingModeStretch];

// mask ImageView
UIImageView *maskImgv = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
maskImgv.image = maskImg;
imgv.maskView = maskImgv;

// animation
[UIImageView animateWithDuration:3.0f animations:^{
    maskImgv.frame = imgv.bounds;
}];

相关文章

网友评论

      本文标题:iOS App的切图

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