示例#1
0
        public static ToastOverlay ShowToast(UIViewController controller, ToastOverlay currentToast, string loadingMessage)
        {
            if (currentToast != null)
            {
                currentToast.Remove();
            }

            var bounds = UIScreen.MainScreen.Bounds;

            if (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeLeft || UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeRight)
            {
                bounds.Size = new CoreGraphics.CGSize(bounds.Size.Height, bounds.Size.Width);
            }

            nfloat labelHeight = 22;
            nfloat labelWidth  = bounds.Width;

            // derive the center x and y
            //nfloat centerX = bounds.Width / 2;
            nfloat centerY = bounds.Height / 2;

            var frameToSend = new CoreGraphics.CGRect(0f, centerY, labelWidth, labelHeight);

            ToastOverlay overlay = new ToastOverlay(frameToSend, loadingMessage);

            controller.View.Add(overlay);

            return(overlay);
        }