我想从我的应用程序发布通知到另一个使用NSNotificationCenter的视图。所以在我的目的地类创建我的观察如下:Xamarin NSNotificatioCenter:我怎样才能让NSObject通过?
NSNotificationCenter.DefaultCenter.AddObserver ("ChangeLeftSide", delegate {ChangeLeftSide(null);});
,我有我的方法:
public void ChangeLeftSide (UIViewController vc)
{
Console.WriteLine ("Change left side is being called");
}
从另一个UIViewController中
现在我发布一个通知如下:
NSNotificationCenter.DefaultCenter.PostNotificationName("ChangeLeftSide", this);
如何访问正在我的发布通知中传递到目标类中的视图控制器?在iOS中它是非常直接的,但我似乎无法找到我的方式monotouch(Xamarin)...
只是有趣的你花了一年的时间找到下面发布的答案:) – Injectios 2016-04-18 13:01:54