首页 > 学院 > 开发设计 > 正文

IOS绘图——简单三角形

2019-11-14 19:32:57
字体:
来源:转载
供稿:网友

#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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表