Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Toast for IOS

Using Xamarin forms to implement toast message.
I have implemented successfully in simple hello world application and works fine (android and iOS).
when I implement the same in my project toast message is not displaying message (iOS). no error showing

I was stuck for 2 days..

Answers

  • UIUXUIUX USMember ✭✭

    @SivaShankarArumugam said:
    Using Xamarin forms to implement toast message.
    I have implemented successfully in simple hello world application and works fine (android and iOS).
    when I implement the same in my project toast message is not displaying message (iOS). no error showing

    I was stuck for 2 days..

    https://stackoverflow.com/questions/35279403/toast-equivalent-on-xamarin-forms

  • SivaShankarArumugamSivaShankarArumugam USMember ✭✭✭

    @ChetanMuley Thanks for the reply. I have tried the above link it works. I want to show the toast on the top.
    But I want know am I missing something like permissions.
    I'm using "Toast for iOS" Component.

  • AllisterAllister USMember ✭✭

    I've just added another answer to the stackoverflow question above, but will post my answer here too:

    We'd normally use Egors Toasts plugin, but as it requires permissions on iOS for a current project we've gone a different route using Rg.Plugins.Popup nuget (https://github.com/rotorgames/Rg.Plugins.Popup).

    I wrote a basic xaml/cs page of type PopupPage,

    <?xml version="1.0" encoding="utf-8" ?>
    <popup:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:popup="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
             x:Class="YourApp.Controls.ToastPage">
    ...
    

    and have it created by a service, whose interface you register at app start or use Xamarin.Forms.DependencyService to fetch the service would be viable too.

    The service news up the PopupPage derived page, and does

    await PopupNavigation.PushAsync(newToastPage);
    await Task.Delay(2000);
    await PopupNavigation.PopAllAsync();
    

    The Popup page can be dismissed by the user by tapping outside the page display (assuming it hasn't filled the screen).

    This seems to work happily on iOS/Droid, but I'm open to correction if anyone knows what this is a risky way of doing it.

Sign In or Register to comment.