美文网首页
CGContext 绘画简单的聊天框

CGContext 绘画简单的聊天框

作者: 寒雨晚风 | 来源:发表于2024-02-19 10:59 被阅读0次

圆弧画法

  CGContextMoveToPoint(context, point3.x, point3.y);  
  CGContextAddArcToPoint(context,point4.x, point4.y,point5.x, point5.y,6.0);

point3 起点 point4 拐点  point5 终点

聊天框 完整代码

- (void)drawRect:(CGRect)rect {

    // Drawing code

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetStrokeColorWithColor(context, [UIColor secondaryLabelColor].CGColor);//线条颜色

    CGContextSetLineWidth(context, 1.0);//线条宽度

    CGContextBeginPath(context);

    CGFloatpointX =100;

    CGPointpoint1 =CGPointMake(pointX,Triangleheight);

    CGPointpoint2 =CGPointMake(pointX+TriangleWidth/2,0);

    CGPoint point3 = CGPointMake(pointX+TriangleWidth, Triangleheight);

    CGPoint point4 = CGPointMake(self.bounds.size.width-1, Triangleheight);

    CGPoint point5 = CGPointMake(self.bounds.size.width-1, self.bounds.size.height-1);

    CGPoint point6 = CGPointMake(1, self.bounds.size.height-1);

    CGPointpoint7 =CGPointMake(1,Triangleheight);

    CGContextMoveToPoint(context, point1.x, point1.y);

    CGContextAddLineToPoint(context, point2.x, point2.y);

    CGContextAddLineToPoint(context, point3.x, point3.y);

    CGContextAddArcToPoint(context,point4.x, point4.y,point5.x, point5.y,6.0);

    CGContextAddArcToPoint(context,point5.x, point5.y, point6.x, point6.y,6.0);

    CGContextAddArcToPoint(context,point6.x, point6.y, point7.x, point7.y,6.0);

    CGContextAddArcToPoint(context,point7.x, point7.y, point1.x, point1.y,6.0);

    CGContextAddLineToPoint(context, point1.x, point1.y);

    CGContextStrokePath(context);

}

相关文章

  • 利用CGContext绘图和CAShapeLayer画线

    用CGContext绘图 创建CGContext上下文 var context: CGContext? 制造CGC...

  • iOS-Swift CGContext实现-文字绘制

    其他文章 iOS-Swift CGContext实现-基础图形 本篇介绍CGContext绘制文字 使用CGCon...

  • 聊天对话框的拉伸简单应用

    做过IM的童鞋都知道气泡聊天,那么怎么实现气泡随着内容的长短变化而做到不拉伸呢,很简单,苹果为我们提供了API,可...

  • 纯CSS循环滚动聊天框

    写了个简单的聊天框循环滚动。逻辑虽然简单,功能已经满足使用了。http://js.jirengu.com/fefo...

  • iOS开发:聊天输入框的实现

    iOS开发:聊天输入框的实现 iOS开发:聊天输入框的实现

  • 沉默的聊天框

    我不知道是否有人会突然在某一瞬间想起另外一个人,然后有些欢喜地给他发出去消息,却在许久之后也得不到答复。 我的朋友...

  • CGContext

  • CGContext

    Quartz 2D绘图目标 管理图形上下文 CGContextFlush:强制将窗口上下文中所有待处理的绘制操作立...

  • iOS 绘图

    1.Quart2D绘图 绘图(CGcontext) 2.贝塞尔曲线 3. 贝塞尔曲线 与 CGcontext 结...

  • iOS-Swift CGContext实现-基础图形

    最近学习了一些关于CGContext绘图的方法,并且在网上也有很多的?。在这里仅做一些介绍。 CGContext ...

网友评论

      本文标题:CGContext 绘画简单的聊天框

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