繁体   English   中英

如何在Xamarin Forms iOS中的特定页面上导航?

[英]How to navigate on specific page in Xamarin Forms iOS?

我正在使用Xamarin Forms并正在使用ANH通知。 我可以从ANH收到通知。 但是问题是当我收到通知并尝试从通知区域打开时,我想在iOS的通知的特定页面上进行重定向。 我在Android上使用了PendingIntent ,但对于iOS我不知道。

另外,我想在应用打开并收到通知时在选项卡上显示徽章。 我正在使用iOS的CustomRenderer 我的TabRenderer代码是:

public class BottomTabbedPage : TabbedRenderer
{       
    public override void ViewWillAppear(bool animated)
    {
        base.ViewWillAppear(animated);
        TabBar.UnselectedItemTintColor = UIColor.FromRGB(208,208,208);
        TabBar.BackgroundColor = UIColor.White;
        TabBar.Items[1].BadgeValue = SettingClass.MenuNotificationCount == 0 ? null : SettingClass.MenuNotificationCount.ToString();
        TabBar.Items[2].BadgeValue = SettingClass.PromoNotificationCount == 0 ? null  : SettingClass.PromoNotificationCount.ToString();
    }
}

当App启动时,将显示徽章,但是当App在后台运行且收到通知时,计数会增加,但在App启动时,徽章不会更新。 我该如何解决?

  • 要导航到特定页面,您可以在收到或处理通知时在AppDelegate.cs中使用以下代码。

等待App.Current.MainPage.Navigation.PushAsync(new specificPage());

  • 要在打开应用程序时更新徽章计数,您需要在收到通知时捕获徽章计数并进行相应的更新。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM