gpt4 book ai didi

xamarin.ios - MonoTouch NSNotificationCenter.DefaultCenter.AddObserver 现在过时了吗?

转载 作者:行者123 更新时间:2023-12-01 10:11:40 25 4
gpt4 key购买 nike

我只是想知道现代相当于什么:

NSNotificationCenter.DefaultCenter.AddObserver("UIDeviceOrientationDidChangeNotification", receivedRotate);

会。它说它已过时,我应该使用 AddObserver,但我不确定要为 IntPtr 上下文变量使用什么。

最佳答案

你不需要 IntPtr 变体,如果你阅读过时的方法,它说:

“改为使用 AddObserver(NSString, Action)”

所以你想要的是

NotificationCenter.DefaultCenter.AddObserver (UIDevice.OrientationDidChangeNotification, receivedRotate);

关于xamarin.ios - MonoTouch NSNotificationCenter.DefaultCenter.AddObserver 现在过时了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4536338/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com