Esempio n. 1
0
		public void Show(string text) {
			// figure out parent
			UIView parentView = null;
			if ((UIApplication.deviceRootViewController != null)
			    && (UIApplication.deviceRootViewController.view != null))
				parentView = UIApplication.deviceRootViewController.view;
			else
				parentView = UIApplication.SharedApplication().keyWindow;

			var frame = parentView.bounds;

			// create view
			if (_activityView == null) {
				_activityView = new UIView(frame);
				_activityView.alpha = 0.8f;
				_activityView.backgroundColor = UIColor.BlackColor();

				_activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
				_activityIndicator.hidesWhenStopped = false;
				_activityView.AddSubview(_activityIndicator);

				_activityLabel = new UILabel(frame);
				_activityLabel.textAlignment = NSTextAlignment.Center;
				_activityLabel.backgroundColor = UIColor.ClearColor();
				_activityLabel.textColor = UIColor.WhiteColor();
				_activityLabel.numberOfLines = 2;
				_activityView.AddSubview(_activityLabel);					
			}

			// re-set frames
			_activityView.frame = frame;

			var indiFrame = _activityIndicator.frame;
			indiFrame.x = frame.width / 2 - indiFrame.width / 2;
			indiFrame.y = frame.height / 2 - indiFrame.height / 2;
			_activityIndicator.frame = indiFrame;

			var labelFrame = new Rect(0, indiFrame.yMax, frame.width, indiFrame.height * 2);
			_activityLabel.frame = labelFrame;

			_activityLabel.text = text;

			// add it to parent
			if (_activityView.superview == null) {
				_activityIndicator.StartAnimating();
				parentView.AddSubview(_activityView);
			}
		}
Esempio n. 2
0
    void Start()
    {
        _webview = new UIWebView(locationAndSize);
        UIApplication.SharedApplication().keyWindow.rootViewController.view.AddSubview(_webview);

        // SayStuff is an offline html file under the Resources/ folder of Unity
        string html = (Resources.Load("SayStuff") as TextAsset).text;

        Debug.Log("HTML: " + html);
        _webview.LoadHTMLString(html, null);


        _webViewDelegate  = new WebViewDelegate();
        _webview.Delegate = _webViewDelegate;


        _webview.backgroundColor = UIColor.ClearColor();
        _webview.opaque          = false;
    }