uchicago-mobi / 2015-Winter-Forum

8 stars 1 forks source link

Issues with drawrect #104

Closed kaiyuand closed 9 years ago

kaiyuand commented 9 years ago

I use the drawrect to draw the two circles and the piechart. However, only the two circles are shown, in the subvention, I use the two arguments about the numbers of open and closed issues passed from the view controller class. When I test with the function, I find that I can get the right answer of open degree, but can not draw the piechart. And if i change the open degree to a constant number, the pie chart will be shown. I don't know what the problem is....maybe the parameter passing is too late that after the time that drawrect function is called? int x= self.OpenIssue; int y= self.ClosedIssue; double openDegree = x/(x+y) * 360;

kaiyuand commented 9 years ago

I have used the setneedsdisplay, but it is still not work, there is no re-draw of the piechart.

tabinks commented 9 years ago

Without seeing your code, it sounds like the its drawing before the values are there. Don't draw your view until viewWillAppear. To debug, you can try putting NSLog statements in the view load cycle to see when the instance variables are available.