0
我想用UIBezierPath
繪製一個傾斜的橢圓。只有一個方法UIBezierPath.init(ovalInRect: rect)
繪製一個橢圓形沒有slop.What我能做什麼來繪製這個?感謝如何用UIBezierPath繪製一個傾斜的橢圓
我想用UIBezierPath
繪製一個傾斜的橢圓。只有一個方法UIBezierPath.init(ovalInRect: rect)
繪製一個橢圓形沒有slop.What我能做什麼來繪製這個?感謝如何用UIBezierPath繪製一個傾斜的橢圓
這裏是一個旋轉的橢圓形的例子:它是在一個遊樂場運行
class MyView: UIView {
override func draw(_ rect: CGRect) {
// create oval centered at (0, 0)
let path = UIBezierPath(ovalIn: CGRect(x: -75, y: -50, width: 150, height: 100))
// rotate it 30 degrees
path.apply(CGAffineTransform(rotationAngle: 30 * .pi/180))
// translate it to where you want it
path.apply(CGAffineTransform(translationX: self.bounds.width/2, y: self.bounds.height/2))
// set stroke color
UIColor.blue.setStroke()
// stroke the path
path.stroke()
}
}
let view = MyView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
view.backgroundColor = .white
這裏:
不錯。非常感謝 –
我想,我可以先得到一個傾斜的長方形,那麼我可以用這個傾斜的矩形畫一個橢圓形 –
這可能是有用的http://stackoverflow.com/questions/10643928/draw-ellipse-with-start-and-end-angle-in-objective-c –
你是什麼意思由傾斜的橢圓形?你介意張貼圖片嗎? –