Closed hopy11 closed 6 years ago
what I mean : "the UI of the vc become very slow after few times,and chart display is not right." is this:
when I quit App and run it again , the chart display correct! (like the 3th picture above) What's wrong with it? thank you!
This usually works
for view in chart.view.subviews {
view.removeFromSuperview()
}
initChart() // code to create chart instance
chart.view.setNeedsDisplay() // this may be necessary to trigger a redraw
If there's still a problem try profiling, or upload a self containing gist and I'll take a look.
OK,it's worked!thanks!
In my ViewController,I write a method createChart() to create a new chart,below is part of the code:
In order to refresh the chart's display in time, I call createChart() in viewWillAppear:
It's mean everytime when user enter the vc,it will first remove chart and then recreate it!
It seem looks good! But actually run the code is bad! it's seem like chart instance not released completely! because the UI of the vc become very slow after few times,and chart display is not right.
my question is : what is the right way for release chart? Is my way correct? thanks :)