[iOS] Prevent crash when a leaked cell has MenuItem with bindings (#3288)

* Prevent crash when a leaked cell in ListView with Recycle mode has MenuItem with bindings and framework like Xamarin.Forms sets BindingContext to null after leaving the page

* Made SetupSelection static
This commit is contained in:
Vitaly Knyazev 2018-08-06 17:57:45 +01:00 коммит произвёл Rui Marinho
Родитель a447b5b1af
Коммит 02f006dfe0
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -630,8 +630,11 @@ namespace Xamarin.Forms.Platform.iOS
return null;
}
void SetupSelection(UITableView table)
static void SetupSelection(UITableView table)
{
if (table.GestureRecognizers == null)
return;
for (var i = 0; i < table.GestureRecognizers.Length; i++)
{
var r = table.GestureRecognizers[i] as SelectGestureRecognizer;
@ -639,7 +642,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
}
_tableView.AddGestureRecognizer(new SelectGestureRecognizer());
table.AddGestureRecognizer(new SelectGestureRecognizer());
}
class SelectGestureRecognizer : UITapGestureRecognizer