将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太阳系行星运转动画
做一个太阳系八大行星的运转动画,不包括行星的卫星,所有行星围绕太阳公转,行星采用纯色,暂时没有自转. 效果静态图: 动画中包括:太阳及各行星,运行轨道,行星公转动画. 先画好草图,设计好大小和位置,根 ...
随机推荐
- Web APi之过滤器执行过程原理解析【二】(十一)
前言 上一节我们详细讲解了过滤器的创建过程以及粗略的介绍了五种过滤器,用此五种过滤器对实现对执行Action方法各个时期的拦截非常重要.这一节我们简单将讲述在Action方法上.控制器上.全局上以及授 ...
- android图片透明度跟缩放大小动画事件
概序 : 动画事件写在xml中,然后用AnimationUtils去加载动画事件,再监听动画结束事件,隐藏imageview. 1. player_double_click_animation.xml ...
- react+redux教程(二)redux的单一状态树完全替代了react的状态机?
上篇react+redux教程,我们讲解了官方计数器的代码实现,react+redux教程(一).我们发现我们没有用到react组件本身的state,而是通过props来导入数据和操作的. 我们知道r ...
- [Keras] Install and environment setting
Documentation: https://keras.io/ 1. 利用anaconda 管理python库是明智的选择. conda update conda conda update anac ...
- objective-c 语法快速过(4)
oc 里的字符串 字符串的快速创建(最简单的方法) NSStirng *str = @“Hello”;//oc的字符串都是@“”形式的 oc的字符串也是类的对象,是NSString类的对象,创建没有那 ...
- Mybatis 入门 -- 最简单的引入和使用
参考:http://www.mybatis.org/mybatis-3/zh/getting-started.html 从今天开始学习官方文档. 1.项目搭建 项目结构: 首先,搭建一个maven项目 ...
- CloudNotes之桌面客户端篇:增强的笔记列表
今天,我发布了CloudNotes的一个更新版本:1.0.5484.36793.这个版本与1.0.5472.20097不同的是,它拥有增强的笔记列表,与之前单调的列表系统相比,新的笔记列表不仅可以显示 ...
- 【原创】HDFS介绍
一. HDFS简介 1. HDFS全称 Hadoop Distributed FileSystem,Hadoop分布式文件系统. Hadoop有一个抽象文件系统的概念,Ha ...
- ASP.NET MVC 模块与组件(一)——发送邮件
我的见解: 模块化与组件化是编程的一种思想:提高代码的重用性,提高开发效率. 常见的模块化就是函数与各种类型的封装,若是代码具有更高的重用价值(能够提供给别人使用),建议可以考虑封装成动态链接库(dl ...
- 修改MySQL自动递增值
alter table tablename auto_increment=num 其中tablename为表的名称,num为要设置的新的自动递增值,此时再Insert一条数据,自动递增值即为num,不 ...