Sto usando il seguente codice all'interno di UIView drawRect
disegnare un rettangolo con angoli arrotondati:
CGContextRef context = UIGraphicsGetCurrentContext();
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:5];
CGContextSetFillColorWithColor(context, _fillColor.CGColor);
[path fill];
CGContextSetLineWidth(context, 1);
CGContextSetStrokeColorWithColor(context, _strikeColor.CGColor);
[path stroke];
Per qualche ragione, sto ottenendo artefatto in ictus: angoli audaci.
Sembra non buono Ho anche provato ad avere un percorso indipendente per l'ictus - lo stesso problema.
risposte:
0 per risposta № 1Pensa che gli angoli siano giusti, ma l'ictus non è visibile. Provare:
rect = CGRectInset(self.bounds, 0.5, 0.5)
Prima di creare il percorso.
0 per risposta № 2
//// Rectangle Drawing
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(57, 48, 136, 31) byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: CGSizeMake(5, 5)];
[rectanglePath closePath];
[UIColor.grayColor setFill];
[rectanglePath fill];