コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            RemoveBackBarButtonTitle();

            ActivityIndicatorView.Hidden = true;
            SaveButton.Hidden            = true;

            TextField.KeyboardType       = UIKeyboardType.Url;
            TextField.Placeholder        = "Website URL";
            TextField.AutocorrectionType = UITextAutocorrectionType.No;
            TextField.BecomeFirstResponder();
            TextField.EditingChanged += (sender, e) =>
            {
                WebView.Hidden    = true;
                SaveButton.Hidden = true;
                HideActivityIndicatorView();
            };
            TextField.EditingDidEndOnExit += (sender, e) =>
            {
                if (String.IsNullOrEmpty(TextField.Text))
                {
                    return;
                }

                URL = TextField.Text.Trim();
                if (!URL.Contains("http"))
                {
                    URL = "http://" + URL;
                }

                if (!StringUtils.IsValidURL(URL))
                {
                    return;
                }

                WebView.Hidden = false;
                WebView.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromString(URL)));
                ActivityIndicatorView.Hidden = false;
                ActivityIndicatorView.StartAnimating();
            };

            SetProgressButton(SaveButton);

            WebViewSuperViewWidthConstraint.Constant = UIScreen.MainScreen.Bounds.Width - 40;

            WebView.Hidden        = true;
            WebView.LoadFinished += (sender, e) =>
            {
                SaveButton.Hidden = false;
                HideActivityIndicatorView();
            };
        }
コード例 #2
0
 public void StartAnimation()
 {
     ActivityIndicatorView?.StartAnimating();
 }