#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. Singleton 单例模板

    // singleton.h #ifndef SINGLETON_H #define SINGLETON_H // 单例基类模板 template <class T> class Sing ...

  2. [ActionScript 3.0] AS3 绘制12面体

    package { import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; im ...

  3. Maven pom.xml 配置详解

    http://niuzhenxin.iteye.com/blog/2042102 http://blog.csdn.net/u012562943/article/details/51690744 po ...

  4. .NET类型转换的常用方式

    第一.隐式转换 byte, short, int, long, fload, double 等,根据这个排列顺序,各种类型的值依次可以向后自动进行转换 如果需要逆转换,则需要进行强制转化.同时考虑溢出 ...

  5. Temporary Segments: What Happens When a Sort Occurs (文档 ID 102339.1)

    APPLIES TO: Oracle Database - Enterprise Edition - Version 8.1.7.4 to 11.2.0.1 [Release 8.1.7 to 11. ...

  6. OC基础(1)

    Objective-C简介 OC和C对比 第一个OC程序 面向对象思想 *:first-child { margin-top: 0 !important; } body > *:last-chi ...

  7. eclipse 调试时出现 Error: [Errno 10013]

    法1: 端口占用错误.换个端口即可. 新端口 在 8001到15536之间的任意值. 法2: windows下查看哪个程序占用端口 netstat -ano | findstr “8080”  找到p ...

  8. windows下如何使用makefile编译

    1. 编写makefile. 2. 使用nmake进行编译, vs2010或者其他都是用nmake进行编译的,将bin目录添加到path环境变量中 先执行vcvars32.bat 再执行nmake

  9. testng参数化方法:Parameters和DataProvider

    Parameters注解在测试方法上指定参数列表,然后在测试方法中声明对应的形参,形参与参数列表一一对应,但名字可以不同,如下所示: public class Test1 { @Parameters( ...

  10. redis错误总结

    1.同步错误.不停重试一直不成功 Full resync from master: e51165e2868c541e28134a287f9bfe36372bae34:80575961684 MASTE ...