#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. win10安装软件被阻止后

    以管理员身份运行CMD,然后在cmd里执行就可以了.

  2. [Java] java中的异常处理-续

    异常处理器,它由try, catch, finally以及随后的程序块组成.finally不是必须的. catch的括号有一个参数,代表所要捕捉的异常的类型.catch会捕捉相应的类型及其衍生类.tr ...

  3. 浅析JAVA_HOME,CLASSPATH和PATH的作用

    1,设置JAVA_HOME:  java的目录一.为了方便引用,比如,你JDK安装在C:\ProgramFiles\Java\jdk1.7.0目录里,则设置JAVA_HOME为该目录路径, 那么以后你 ...

  4. 九度OJ1468

    这道题其实就是个很简单的静态链表,需要注意的是,地址一共有5位,最后输出的时候如果之前是使用int类型存储地址的话,一定要强制规定输出的位数(5位),否则有可能会将高位省略.(如地址00001输出为1 ...

  5. esriSRProjCS2Type Constants

    ArcGIS Developer Help  (Geometry)   esriSRProjCS2Type Constants See Also esriSRProjCSType Constants ...

  6. Mingyang.net:No identifier specified for entity

    org.hibernate.AnnotationException: No identifier specified for entity: net.mingyang.modules.system.C ...

  7. iOS UIButton 设置图片文字垂直排列

    后面经过测试,如果button的文字长度变更,会导致图片位置变化,经过多次修改UIEdgeInsets的值也没有达到期望效果,最终采用集成UIButton类,重写layoutSubviews函数实现, ...

  8. OC基础(3)

    对象的存储细节 函数与方法对比 常见错误 *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bot ...

  9. Fragments | Android Developer

    Definition A Fragment represents a behavior or a potion of user interface in an Activity. You can co ...

  10. 【LeetCode】13. Roman to Integer 罗马数字转整数

    题目: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from ...