xabre / xamarin-forms-tab-badge

Xamarin Forms bindable Tab badges for iOS, Android, UWP, MacOS and WPF
MIT License
307 stars 75 forks source link

How to update badge count when used Tabredered in iOS? #50

Closed Srusti-Thakkar closed 6 years ago

Srusti-Thakkar commented 6 years ago

Thanks for the plugin. I am using your plugin and just customize my Tabbed page in iOS. Now the issue is badges are not updating. How can I update badge count while used custom tabrender in iOS? My code is :

[assembly: ExportRenderer(typeof(TabbedPage), typeof(BottomTabbedPage))]
namespace Graysons.iOS.Renderers
{
    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 = "1";
            TabBar.Items[2].BadgeValue = "1";

        }
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

        }
    }
}
xabre commented 6 years ago

Hi @Srusti-Thakkar, you would need to inherit from BadgedTabbedRenderer instead of TabbedRenderer

Srusti-Thakkar commented 6 years ago

Okay. Thanks I will try.