1
簡単な質問を描画していない、私はUILabel
とcircle.The円とUIView
でこのdrawRect
方法が正しく描画されてしまったが、UILabel
ではありません。UILabelは
アイデア?
ありがとうございました。
- (void)drawRect:(CGRect)theRect{
CGRect rect = self.bounds;
//text label
UILabel * pText = [[UILabel alloc] initWithFrame: rect];
pText.text = @"demo";
// Circle
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:rect];
rect = CGRectInset(rect, 5, 5);
[path appendPath:[UIBezierPath bezierPathWithOvalInRect:rect]];
path.usesEvenOddFillRule = YES;
[self.color set];
[path fill];
}
これは 'drawRect'ではなく、一度実行される場所で行います。 'drawRect'は複数回呼び出されるかもしれません。 – mvds
ええ、私はmvdsに同意します。 – Gianz
すばらしかったThxみんな! UIBezierPathに描画命令が含まれているため、ビューオブジェクトでありrectではないため、UILabelを追加する必要はありますか? – chriz