简体   繁体   中英

Trigger draw(rect) function

In my app I have a chart into an UIView. This chart is drawed using override func draw(_ rect: CGRect) {} . Trouble is that datas to populate the chart comes from the ViewController which contains the UIView and they need some time to be calculated before being available for the chart.

Best thing would to launch draw(rect) code after datas calculation but I can't trigger this action, which run when UIView appear so I can't find a way to draw this chart with my datas, how can I do that?

准备好后,您是否尝试过在视图上调用 setNeedsDisplay(),这应该会触发绘图。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM