将UIview描画成虚线等.
- (UIView *)lineView{
if (!_lineView) {
_lineView = [UIView new];
// _lineView.backgroundColor = UIColorWithRGB(127, 127, 127);
_lineView.frame = CGRectMake(, 13.5 + 5.5 , totalWith / - - - , );
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
[shapeLayer setBounds:_lineView.bounds];
[shapeLayer setPosition:CGPointMake(CGRectGetWidth(_lineView.frame) / , CGRectGetHeight(_lineView.frame))];
[shapeLayer setFillColor:UIColorWithRGB(, , ).CGColor];
// 设置虚线颜色为blackColor
[shapeLayer setStrokeColor:UIColorWithRGB(, , ).CGColor];
// 设置虚线宽度
[shapeLayer setLineWidth:CGRectGetHeight(_lineView.frame)];
[shapeLayer setLineJoin:kCALineJoinRound];
// 设置线宽,线间距
[shapeLayer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:], [NSNumber numberWithInt:], nil]];
// 设置路径
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, CGRectGetWidth(_lineView.frame), );
[shapeLayer setPath:path];
CGPathRelease(path);
// 把绘制好的虚线添加上来
[_lineView.layer addSublayer:shapeLayer];
}
return _lineView;
}
复制文本
- (UIView *)fuzhi {
if (_fuzhi == nil) {
_fuzhi = [[UIView alloc] init];
_fuzhi.frame = CGRectMake(ScreenWidth / , CGRectGetMinY(self.jubao.frame), ScreenWidth / , CGRectGetHeight(self.content.frame) / - );
_fuzhi.center = CGPointMake(ScreenWidth * / , _fuzhi.centerY);
UIImageView *image = [[UIImageView alloc] init];
image.frame = CGRectMake(, , CGRectGetWidth(_fuzhi.frame) - , CGRectGetWidth(_fuzhi.frame) - );
image.image = [UIImage imageNamed:@"复制icon"];
[_fuzhi addSubview:image];
UILabel *label = [[UILabel alloc] init];
label.frame = CGRectMake(, CGRectGetMaxY(image.frame), CGRectGetWidth(image.frame), );
label.text = @"复制";
label.textColor = [UIColor lightGrayColor];
[_fuzhi addSubview:label];
label.center = CGPointMake(image.centerX, label.centerY);
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont systemFontOfSize:];
UITapGestureRecognizer *tap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fzClick)];
[_fuzhi addGestureRecognizer:tap];
}
return _fuzhi;
}
-(void)fzClick
{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = _model.Content;
[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
[SVProgressHUD setMinimumDismissTimeInterval:];
[SVProgressHUD showSuccessWithStatus:@"复制成功"];
}
将UIview描画成虚线等.的更多相关文章
- 将UIView转成UIImage,将UIImage转成PNG/JPG
分类: UIImageView2013-03-12 17:37 350人阅读 评论(0) 收藏 举报 //UIView -> UIImage #import “QuartzCore/Quartz ...
- 如何把UIView转成UIImage,解决模糊失真问题
最近工作中,遇到一个需求,需要把一个UIView对象转成UIImage对象显示.经过网络搜索,找到如下答案: ? 1 2 3 4 5 6 7 8 -(UIImage*)convertViewToIma ...
- 把UIView转成UIImage,解决模糊失真问题
近期工作中,遇到一个需求,须要把一个UIView对象转成UIImage对象显示.经过网络搜索.找到例如以下答案: ? 1 2 3 4 5 6 7 8 -(UIImage*)convertViewToI ...
- 教你把UIView切成任意形状
有时候layer.cornerRadius并不能满足需求,自己实现drawRect又太麻烦,怎么办? 多的不说,直接上代码: - (void)dwMakeBottomRoundCornerWithRa ...
- android自定义View---生成虚线的View
1.在res/values/目录下 新建文件 attrs.xml <? xml version = "1.0" encoding = "utf-8&q ...
- 画虚线 iOS
整理了一个方法,可以直接绘制虚线,下面直接上代码.参数说明已经给出,可直接copy使用 /** ** lineView: 需要绘制成虚线的view ** lineLength: 虚线的宽度 ** li ...
- Swift - 使用UIView给页面添加4×4方格
1,下面是一个利用UIView来给页面上绘制灰色方块的例子,效果图如下: 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...
- iOS 使用Quartz和OpenGL绘图
http://blog.csdn.net/coder9999/article/details/7641701 第十二章 使用Quartz和OpenGL绘图 有时应用程序需要能够自定义绘图.一个库是Qu ...
- html+ccs3太阳系行星运转动画
做一个太阳系八大行星的运转动画,不包括行星的卫星,所有行星围绕太阳公转,行星采用纯色,暂时没有自转. 效果静态图: 动画中包括:太阳及各行星,运行轨道,行星公转动画. 先画好草图,设计好大小和位置,根 ...
随机推荐
- 掌握 cinder-scheduler 调度逻辑 - 每天5分钟玩转 OpenStack(48)
上一节我们详细讨论了 cinder-api 和 cinder-volume,今天讨论另一个重要的 Cinder 组件 cinder-scheduler. 创建 Volume 时,cinder-sche ...
- 好玩的SQL
1. 做一个3*3的加法表 SQL), (); A||'+'||B||'='||(A+B) ------------------------------------------------------ ...
- 理解HTTP协议
在互联网时代HTTP协议的重要性无需多言,对于技术岗位的同学们来说理解掌握HTTP协议是必须的.本篇博客就从HTTP协议的演进.特性.重要知识点和工作中常见问题的总结等方面进行简单的介绍.理解掌握了这 ...
- Kooboo CMS - Html.FrontHtml.Position 详解
DataContract 数据契约 http://www.cnblogs.com/Gavinzhao/archive/2010/06/01/1748736.html https://msdn.micr ...
- 浅谈移动端之touch事件--手指的滑动事件
今天台风‘海马’袭击深圳,全市停工.现分享一篇关于touch的文章,望指教! 原理: 当开始一个touchstart事件的时候,获取此刻手指的横坐标startX和纵坐标startY: 当触发touch ...
- Eclipse与Android源码中ProGuard工具的使用
由于工作需要,这两天和同事在研究android下面的ProGuard工具的使用,通过查看android官网对该工具的介绍以及网络上其它相关资料,再加上自己的亲手实践,算是有了一个基本了解.下面将自己的 ...
- co.js - 让异步代码同步化
近期在全力开发个人网站,并且又沉淀了一些前后端的技术.近期会频繁更新. 这篇文章首发于我的个人网站:听说 - https://tasaid.com/,建议在我的个人网站阅读,拥有更好的阅读体验. 这篇 ...
- 微信小程序(应用号)开发体验
昨天微信小程序(应用号)内测的消息把整个技术社区炸开了锅, 我也忍不住跟了几波,可惜没有内测资格,听闻破解版出来了, 今天早上就着原来的项目资源试开发了一下,总结一下体验. 总体体验 开发效率高,6: ...
- 数据结构:顺序表(python版)
顺序表python版的实现(部分功能未实现) #!/usr/bin/env python # -*- coding:utf-8 -*- class SeqList(object): def __ini ...
- ABySS非root权限安装
本文转自 http://yangl.net/2015/11/12/abyss_install/ ABySS: ABySS is a de novo, parallel, paired-end seq ...