0

ペイントコードを使用してアプリの丸いボタンを作成しています。私が従う手順は、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];
4

1 に答える 1