Esempio n. 1
0
        public LoadSpinner(string title, string message)
        {
            activity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);;

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                activity.Color = UIColor.Black;

                label = new UILabel()
                {
                    Lines         = 1,
                    LineBreakMode = UILineBreakMode.TailTruncation,
                    TextAlignment = UITextAlignment.Center,
                    TextColor     = UIColor.Black
                };

                view = new LoadView()
                {
                    BackgroundColor = new UIColor(1, 1, 1, 0.85f),
                    Transform       = TouchFactory.KeyWindow.RootViewController.View.Transform
                };

                view.Layer.CornerRadius = 10;
                view.Layer.BorderColor  = new CoreGraphics.CGColor(0.875f, 0.875f, 0.875f);
                view.Layer.BorderWidth  = 1;
                view.Add(label);
                view.Add(activity);

                // flexible margins don't work on iOS 7 and transforms never change on iOS 8, so we have to deal with each separately
                if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                {
                    view.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
                }
                else
                {
                    TouchFactory.KeyWindow.RootViewController.View.AddObserver(view, new NSString("transform"), NSKeyValueObservingOptions.New, System.IntPtr.Zero);
                }
            }
            else
            {
                activity.Center = new CGPoint(140, 70);
                alertView       = new UIAlertView(new RectangleF(0, 0, 300, 200));
                alertView.Add(activity);
            }

            Title = title;
        }