there is such code:
Code: Select all
protected void initVars()
{
...
NSNotificationCenter.DefaultCenter.AddObserver((NSString)"UIDeviceOrientationDidChangedNotification",
delegate {
this.chart.Invalidate();
});
...
1. "UIDeviceOrientationDidChangedNotification" should be "UIDeviceOrientationDidChangeNotification"
2. added observer, when init, however, haven't unregister it when dispose this object. thus DefaultCenter will always refer to the delegate method, which caused gc will not collect the Tchart object. I think it should be like this:
Code: Select all
private readonly NSObject notification;
protected void initVars()
{
...
notification = NSNotificationCenter.DefaultCenter.AddObserver((NSString)"UIDeviceOrientationDidChangeNotification",
delegate {
this.chart.Invalidate();
});
...
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
notification.Dispose();
}
base.Dispose(disposing);
}
https://developer.apple.com/documentati ... tification