我正在使用xamarin表单项目,并且我在xamarin iOS项目上有一个错误。目前我实现了主 - 细节页面的功能,并且我在操作栏上添加了按钮项目。问题是当我从我的MainPage运行应用程序时我正在从我的汉堡菜单移动到另一个页面,然后又返回到MainPage,一切似乎都很好。但是,当我滚动我的MainPage转盘到另一个对象,我的动作条项点击我收到这样的错误:Xamarin iOS无法访问处置对象,对象名称:''
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CustomNavigationRenderer'.
这是我的iOS CustomNavigationRenderer类:
[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
public class CustomNavigationRenderer : NavigationRenderer
{
private string pName;
private int pCCount;
private string pCName;
private App MainApp { get; set; }
public override void ViewDidLoad()
{
base.ViewDidLoad();
}
private void CIndexChanged(int pCCount, string pName)
{
UIBarButtonItem providerBtn = TopViewController.NavigationItem.RightBarButtonItems[0];
}
在调试TopViewController我得到了这样的一行:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CustomNavigationRenderer'.
但直到我从当前对象滚动到TopViewController对调试模式这样的行另一个旋转视图对象:
Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController
什么可能是主要原因,该对象没有达到该行动栏项目?