class="p1">#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