【发布时间】:2010-11-02 12:14:50
【问题描述】:
嗨,我正在将 UIView 添加到窗口。
这个视图有drawRect as-
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 300, 400);
CGContextStrokePath(context);
}
但是这段代码没有画线。 所以有什么帮助吗??????
【问题讨论】:
-
如果您只是在编辑时阅读问题框旁边的格式说明,您将为自己省去一个痛苦的世界。将代码缩进四个空格(并且不需要在每一行都使用
<br>)。 -
我不知道是否有必要,但调用
CGContextSetStrokeColor...函数之一可能是个好主意。
标签: iphone objective-c ios4