自定义渲染器中的e.OldElement和e.NewElement

时间:2018-08-28 19:03:46

标签: xamarin xamarin.forms xamarin.ios xamarin.android

Here Microsoft告诉我们在自定义渲染器中使用stat_contoure.OldElement

  

...为防止内存泄漏,在实例化新的内存时必须小心   本机控制...

     

...

e.NewElement

另一方面,here他们忽略了自己的推荐:

  if (e.OldElement != null) {
    // Unsubscribe from event handlers and cleanup any resources
  }

  if (e.NewElement != null) {
    // Configure the control and subscribe to event handlers
  }

那么我们还是不必担心它们?还是取决于情况(因此:在哪里?)?

0 个答案:

没有答案