- 浏览: 333258 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
leslie89757:
[img][img][img][img][img][img][ ...
CocoaPods 安装使用 -
hanmeizhi:
very useful to me. Thanks
Dismissing MPMoviePlayerViewController the right way -
luzj:
这个考虑不周全, 在iOS5的键盘高度就不是这个值了,这样写死 ...
UITextView: move view when keyboard appears -
xjg19870111:
不错。
objective-c NSString 常用操作 -
juedui0769:
现在已经不行了!
android源码下载
虚线:
切线:
An arc may be drawn by specifying two tangent points and a radius using the CGContextAddArcToPoint() function:
Drawing an Ellipse or Circle
Circles and ellipses are drawn by defining the rectangular area into which the shape must fit and then calling the CGContextAddEllipseInRect() function:
Drawing a Cubic Bézier Curve
A cubic Bézier curve may be drawn by moving to a start point and then passing two control points and an end point through to the CGContextAddCurveToPoint() function:
Drawing a Quadratic Bézier Curve
A quadratic Bézier curve is drawn using the CGContextAddQuadCurveToPoint() function, providing a control and end point as arguments having first moved to the start point:
Dashed Line Drawing
So far in this chapter we have performed all our drawing with a solid line. Quartz also provides support for drawing dashed lines. This is achieved via the Quartz CGContextSetLineDash() function which takes as its arguments the following:
context – The graphics context of the view on which the drawing is to take place
phase - A floating point value that specifies how far into the dash pattern the line starts
lengths – An array containing values for the lengths of the painted and unpainted sections of the line. For example an array containing 5 and 6 would cycle through 5 painted unit spaces followed 6 unpainted unit spaces.
count – A count of the number of items in the lengths array
For example, a [2,6,4,2] lengths array applied to a curve drawing of line thickness 5.0 will appear as follows:
The corresponding drawRect code that drew the above line reads as follows:
CGContextSetStrokeColorWithColor(myContext, [UIColor blackColor].CGColor); CGContextSetLineDash (myContext,phase,lengths,2); CGContextClosePath(myContext); CGContextStrokePath(myContext);
切线:
An arc may be drawn by specifying two tangent points and a radius using the CGContextAddArcToPoint() function:
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGContextMoveToPoint(context, 100, 100); CGContextAddArcToPoint(context, 100,200, 300,200, 100); CGContextStrokePath(context); }
Drawing an Ellipse or Circle
Circles and ellipses are drawn by defining the rectangular area into which the shape must fit and then calling the CGContextAddEllipseInRect() function:
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGRect rectangle = CGRectMake(60,170,200,80); CGContextAddEllipseInRect(context, rectangle); CGContextStrokePath(context); }
Drawing a Cubic Bézier Curve
A cubic Bézier curve may be drawn by moving to a start point and then passing two control points and an end point through to the CGContextAddCurveToPoint() function:
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGContextMoveToPoint(context, 10, 10); CGContextAddCurveToPoint(context, 0, 50, 300, 250, 300, 400); CGContextStrokePath(context); }
Drawing a Quadratic Bézier Curve
A quadratic Bézier curve is drawn using the CGContextAddQuadCurveToPoint() function, providing a control and end point as arguments having first moved to the start point:
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGContextMoveToPoint(context, 10, 200); CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200); CGContextStrokePath(context); }
Dashed Line Drawing
So far in this chapter we have performed all our drawing with a solid line. Quartz also provides support for drawing dashed lines. This is achieved via the Quartz CGContextSetLineDash() function which takes as its arguments the following:
context – The graphics context of the view on which the drawing is to take place
phase - A floating point value that specifies how far into the dash pattern the line starts
lengths – An array containing values for the lengths of the painted and unpainted sections of the line. For example an array containing 5 and 6 would cycle through 5 painted unit spaces followed 6 unpainted unit spaces.
count – A count of the number of items in the lengths array
For example, a [2,6,4,2] lengths array applied to a curve drawing of line thickness 5.0 will appear as follows:
The corresponding drawRect code that drew the above line reads as follows:
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 5.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGFloat dashArray[] = {2,6,4,2}; CGContextSetLineDash(context, 3, dashArray, 4); CGContextMoveToPoint(context, 10, 200); CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200); CGContextStrokePath(context); }
发表评论
-
IOS7.1 企业应用 证书无效 已解决
2014-05-10 10:53 728http://www.cocoachina.com/bbs/r ... -
xCode Find&Replace快捷键
2013-10-28 10:44 865As for Find & Replace, they ... -
iOS整合zxing需要注意的地方
2013-08-02 23:34 2060Well, at last I got it working. ... -
iOS 自定义Tabbar
2013-07-30 22:55 1151http://www.appcoda.com/ios-prog ... -
Apple Push Notification Service总结
2013-07-29 22:39 1083苹果推送通知服务使用总结 1. 在 Mac 上从 KeyCha ... -
iOS 消息推送原理及实现
2013-07-12 13:40 826链接: http://www.dapps.net/dev/ ... -
GIMP IMAGE MAP
2013-05-29 16:13 816使用GIMP 制作 IMAGE MAP 1. 选择图片,用G ... -
INSPIRATION
2013-05-27 18:21 775http://www.patternsofdesign.co. ... -
iOS 自定义控件系列
2013-05-27 17:09 1443iOS自定义控件 自定义UITableViewCell ht ... -
CocoaPods 使用教程
2013-05-27 14:49 730http://mobile.tutsplus.com/tuto ... -
IOS 开发之设置UIButton的title
2013-05-11 22:03 1165btn.frame = CGRectMake(x, y, wi ... -
REActivityViewController 使用 备忘
2013-04-22 21:38 1027REActivityViewController Out o ... -
VPS配置二级域名
2013-04-18 23:08 7381. 域名解析商配置泛解析 主机记录 * 记录类型 A 2. ... -
ios 开发NewsStand指南
2013-04-13 21:44 1286http://www.viggiosoft.com/blog/ ... -
Python Django mod_wsgi Windows 部署过程 备忘
2013-04-10 18:28 1544部署环境:Windows2003Server 1. 安装Ap ... -
网站迁移 备忘
2013-04-10 14:58 7051. 备份数据库。。。导出的格式和编码要注意 2. 完全导出网 ... -
Windows下命令行查看端口占用
2013-04-09 23:42 692在windows命令行窗口下执行: C:\>netst ... -
带预览功能又可分页的UIScrollView
2013-04-05 12:56 784带预览功能又可分页的UIScrollView http:// ... -
25 iOS App 性能优化
2013-04-05 10:51 655http://www.raywenderlich.com/ ... -
UIScrollView滚动, 中间显示整图, 前后露出部分图
2013-04-04 00:12 1169UIScrollView *scrollowView = [[ ...
相关推荐
Quartz 2D is an advanced, two-dimensional drawing engine available for iPhone application development and to all Mac OS X application environments outside of the kernel. Quartz 2D provides low-level, ...
NXDrawKit 是一个简单和易于使用的iPhone绘图工具
NXDrawKit, NXDrawKit是一款简单而简单但实用的iPhone绘图工具 它刚开始为我的个人iPhone应用。 但是,它不能像你所需的那样定制,你可以使用平滑徒手绘制视图查看。 我为使用 Canvas 制作了 Palette 和 ToolBar,...
iPhone/iPad 绘图应用 Brushes ,Brushes 是一个绘图应用,支持 iPhone, iPod touch 和 iPad。
C 开发的绘图程序, 包括直线,椭圆 ,矩形,曲线,撤销,清屏,颜色和线性设定,图片保存,以及相册中的图片处理功能(图片移动,放大,缩小),以及其他各种功能,集各种功能与一身,代码清晰,简洁易懂,非常适合iphone初学者.
《Iphone开发基础教程》第十二章实用Quartz和OpenGL绘图(之Quartz绘图),源代码下载!具体的讲解在我的blog上面,blog.sina.com.cn/wanmeiguanjun.欢迎指点!
iphone X iphone 8 原型框 iphone X iphone 8 原型框
iPhone狂:约会iPhone
Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码——Iphone主题源码Iphone开发系列源码...
iphoneos-arm iPhone 必备工具
Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码...
iphone3,1 shsh iphone4 5.1.1iphone3,1 shsh iphone4 5.1.1
ios iphone 源码 iphone桌面截图代码
iPhone4各版本shsh
iphone SDK 下载BT
卡iPhone在线支持MAX右键执行本站登录上iPhone,再选择你要卡的机型开始工作即可。 目前只有iphone 9、XS、XS Plus在线,建议卡XS在线比较真实,因为腾讯这边还没更新 腾讯这边如果更新XR、Max,软件也会进行更新 ...
这个版本是完整的,能够下载。 iphone开发的初级教程,如果你对开发iphone无从下手就看这本书吧。
iPhone开发实战 iPhone开发 iPhone iPhone4 iPhone开发实战 iPhone开发 iPhone iPhone4
Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image图片缩放随着手指Iphone开发系列源码——Image...