【发布时间】:2013-11-23 21:19:23
【问题描述】:
我需要将 PaintCode sn-ps 集成到 XCode 中,但到目前为止我在模拟器中没有看到结果,这是一个矩形的 sn-p:
// Rounded Rectangle Drawing
UIBezierPath *roundedRectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(45.5, 89.5, 232, 273) cornerRadius:3];
[[UIColor whiteColor] setFill];
[roundedRectanglePath fill];
[[UIColor blackColor] setStroke];
[roundedRectanglePath setLineWidth: 10];
[roundedRectanglePath stroke];
我在实现文件中使用了一个 void 函数:
- (void) drawRect: (CGRect)rect
{
// snippet goes here
}
【问题讨论】:
-
这是在某些 UIView 子类中完成的吗?视图是屏幕视图层次结构的一部分吗?
-
不在子类中,在视图控制器中,但我尝试对其进行子类化,仍然不起作用。
-
drawRect:在视图中工作,而不是在视图控制器中。 -
但是我尝试将它子类化到 UIView,它仍然没有工作......
-
上面没有提到 UIView 或显示你正在做什么以将视图放到屏幕上。每次您提到“视图控制器”时,我都会更加怀疑您将代码放在错误的位置。 :)
标签: objective-c ios6.1