【发布时间】:2014-03-09 15:47:59
【问题描述】:
我正在使用 Paintcode 为我的应用创建圆形按钮。我遵循的步骤是 - 创建为 UIButton 派生的新类,将由paintcode 生成的代码粘贴到 (void)drawRect:(CGRect)rect 中并设置按钮以使用我的自定义类。但是我做错了,因为按钮根本没有任何形状,它只是一个标签。这是我使用的代码 -
//// Color Declarations
UIColor* strokeColor = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 1];
UIColor* fillColor2 = [UIColor colorWithRed: 0.886 green: 0 blue: 0 alpha: 1];
//// Rounded Rectangle Drawing
UIBezierPath* roundedRectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(44.5, 45.5, 48, 20) cornerRadius: 4];
[fillColor2 setFill];
[roundedRectanglePath fill];
[strokeColor setStroke];
roundedRectanglePath.lineWidth = 1;
[roundedRectanglePath stroke];
【问题讨论】:
标签: ios custom-controls paintcode