#import <UIKit/UIKit.h>

@interface MyView : UIView

@end

#import "MyView.h"

@implementation MyView

- (instancetype)initWithFrame:(CGRect)frame {

self = [super initWithFrame:frame];

if (self) {

// Initialization code

}

return self;

}

- (void)drawRect:(CGRect)rect {

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextMoveToPoint(context, 75, 10);

CGContextAddLineToPoint(context, 10, 150);

CGContextAddLineToPoint(context, 160, 150);

CGContextClosePath(context);

[[UIColor blackColor] setStroke];

[[UIColor redColor] setFill];

CGContextDrawPath(context, kCGPathFillStroke);

}

@end


我的CSDN博客地址:http://blog.csdn.net/qw963895582/article

IOS绘图——简单三角形的更多相关文章

  1. iOS绘图教程 (转,拷贝以记录)

    本文是<Programming iOS5>中Drawing一章的翻译,考虑到主题完整性,在翻译过程中我加入了一些书中没有涉及到的内容.希望本文能够对你有所帮助. 转自:http://www ...

  2. iOS绘图教程

    本文是<Programming iOS5>中Drawing一章的翻译,考虑到主题完整性,翻译版本中加入了一些书中未涉及到的内容.希望本文能够对你有所帮助.(本文由海水的味道翻译整理,转载请 ...

  3. 论文第4章:iOS绘图平台的实现

    面向移动设备的矢量绘图平台设计与实现 Design and Implementation of Mobile Device-oriented Vector Drawing Platform 引用本论文 ...

  4. iOS绘图系统UIKit与Core Graphics

    概述 iOS主要的绘图系统有UIKit,Core Graphics,Core Animation,Core Image,Open GL等,本片博文主要介绍UIKit与Core Graphics的绘图系 ...

  5. iOS上简单推送通知(Push Notification)的实现

    iOS上简单推送通知(Push Notification)的实现 根据这篇很好的教程(http://www.raywenderlich.com/3443/apple-push-notification ...

  6. IOS绘图

    #import "ViewController.h" #import "DrawView.h" @interface ViewController () @pr ...

  7. iOS绘图框架CoreGraphics分析

    由于CoreGraphics框架有太多的API,对于初次接触或者对该框架不是十分了解的人,在绘图时,对API的选择会感到有些迷茫,甚至会觉得iOS的图形绘制有些繁琐.因此,本文主要介绍一下iOS的绘图 ...

  8. iOS CAReplicatorLayer 简单动画

    代码地址如下:http://www.demodashi.com/demo/11601.html 写在最前面,最近在看学习的时候,偶然间发现一个没有用过的Layer,于是抽空研究了下,本来应该能提前记录 ...

  9. iOS之简单瀑布流的实现

    iOS之简单瀑布流的实现   前言 超简单的瀑布流实现,这里说一下笔者的思路,详细代码在这里. 实现思路 collectionView能实现各中吊炸天的布局,其精髓就在于UICollectionVie ...

随机推荐

  1. mycat未配置对应表导致报错

    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: can't find table define in sch ...

  2. 创建一个hibernate helloword

    1.下载hibernate包 http://hibernate.org/orm/ 点download下载最终版 安装hibernate插件hibernatetools 2.创建一个java工程 导入必 ...

  3. [ActionScript&Flex] FlashBuilder编译条件之如何屏蔽调试代码

    下面讲一下在FlashBuilder中如何添加编译器参数使我们在发布的时候不编译调试代码: 首先设置编译参数 编译参数设置好后,代码我们可以这样写: public class ConditionalC ...

  4. 有没有一行文件字过多后可以省略号显示,我说的不是用其他样式,BT本身有没有?谢谢

    .text-overflow {display: inline-block;max-width: 200px;overflow: hidden;text-overflow: ellipsis;whit ...

  5. 使用 Heka 导入自定义的nginx日志到Elasticsearch

    重置Heka执行进度 heka的进度配置文件存在配置项 base_dir 设置的目录,只需要删除这个文件夹下面的内容,就可以完全重置heka的进度. base_dir 配置项默认是在下面目录: '/v ...

  6. C语言实现词频统计——第二版

    原需求 1.读取文件,文件内包可含英文字符,及常见标点,空格级换行符. 2.统计英文单词在本文件的出现次数 3.将统计结果排序 4.显示排序结果 新需求: 1.小文件输入. 为表明程序能跑 2.支持命 ...

  7. 21.Merge Two Sorted Lists(链表)

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  8. oracle参数open_cursors和session_cached_cursor详解!

    SQL> show parameter open_cursors           --每个session(会话)最多能同时打开多少个cursor(游标) NAME               ...

  9. namespace用法

    1.在WCF.Controller中定义了一个UserModel,标记为① 2.在WCF.Controller.Model中定义了一个UserModel(同上,namespace不同),标记为② 3. ...

  10. OC基础(26)

    集合对象的内存管理 Copy copy与内存管理 @property中的copy关键字 自定义的类实现copy操作 *:first-child { margin-top: 0 !important; ...