• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UIWebView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UIWebView的典型用法代码示例。如果您正苦于以下问题:C# UIWebView类的具体用法?C# UIWebView怎么用?C# UIWebView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIWebView类属于命名空间,在下文中一共展示了UIWebView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			webView = new UIWebView (new RectangleF(0, (_addCancelButton) ? navigationBarHeight : 0, View.Frame.Width, (_addCancelButton) ? View.Frame.Height - navigationBarHeight : View.Frame.Height));
			webView.Delegate = new WebViewDelegate(RequestStarted, RequestFinished);

			if (!_addCancelButton) {
				this.View.AddSubview (webView);
			} else {
				var cancelButton = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
				cancelButton.Clicked += (object sender, EventArgs e) => {
					_cancelled();
					this.DismissViewController(true, null);
				};

				var navigationItem = new UINavigationItem {
					LeftBarButtonItem = cancelButton
				};

				navigationBar = new UINavigationBar (new RectangleF (0, 0, View.Frame.Width, navigationBarHeight));
				navigationBar.PushNavigationItem (navigationItem, false);

				this.View.AddSubviews (navigationBar, webView);
			}
		}
开发者ID:robertherber,项目名称:PersonalTasks,代码行数:26,代码来源:BaseAuthenticationViewController.cs


示例2: FinishedLaunching

        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            App_Window = new UIWindow(UIScreen.MainScreen.Bounds);
            var vc = new UIViewController();
            var view = new UIView();

            var button = UIButton.FromType(UIButtonType.RoundedRect);
            button.Frame = new RectangleF(0, 0, 100, 40);
            button.SetTitle("Do It", UIControlState.Normal);
            button.TouchDown += delegate {
                Test_JSON();
            };
            view.AddSubview(button);

            Browser = new UIWebView();
            Browser.Frame = new RectangleF(0, 50, UIScreen.MainScreen.Bounds.Width,
                UIScreen.MainScreen.Bounds.Height-50);
            view.AddSubview(Browser);

            vc.View = view;
            App_Window.RootViewController = vc;
            App_Window.MakeKeyAndVisible();

            return true;
        }
开发者ID:t9mike,项目名称:ServiceStack-JSON1,代码行数:25,代码来源:AppDelegate.cs


示例3: ShouldStartLoad

 public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
 {
     bool shouldStart = true;
     string url = request.Url.ToString();
     if (url.Contains("js-frame"))
     {
         shouldStart = false;
         string pendingArgs = bridge.webBrowser.EvaluateJavascript("window.locationMessenger.pendingArg.toString();");
         // Using JsonConvert.Deserialze<string[]> blows up under MonoTouch, so manually build the array of args instead
         JArray argsJArray = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(pendingArgs);
         string[] args = new string[argsJArray.Count];
         for (int i = 0; i < argsJArray.Count; i++)
             args[i] = (string)argsJArray[i];
         if (args[0] == "HandleScriptPropertyChanged")
         {
             if (args.Length == 3)
                 bridge.HandleScriptPropertyChanged(args[1], args[2], null);
             else
                 bridge.HandleScriptPropertyChanged(args[1], args[2], args[3]);
         }
         else if (args[0] == "InvokeViewModelIndexMethod")
             bridge.InvokeViewModelMethod(args[1], args[2], args[3]);
         else if (args[0] == "InvokeViewModelMethod")
             bridge.InvokeViewModelMethod(args[1], args[2]);
         else if (args[0] == "HandleDocumentReady")
             bridge.HandleDocumentReady();
         else if (args[0] == "HostLog")
             bridge.HostLog(args[1]);
         else
             SpinnakerConfiguration.CurrentConfig.Log(SpinnakerLogLevel.Error,"Ignoring unrecognized call from javascript for [" + args[0] + "] - this means that javascript in the view is trying to reach the host but with bad arguments");
     }
     return shouldStart;
 }
开发者ID:Claytonious,项目名称:spinnaker,代码行数:33,代码来源:ScriptObject.cs


示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (!string.IsNullOrEmpty(IdentityProviderName))
                Title = IdentityProviderName;

            _webView = new UIWebView(new RectangleF(0,0, View.Bounds.Width, View.Bounds.Height))
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleBottomMargin
            };
            _webView.ShouldStartLoad += ShouldStartLoad;
            _webView.LoadStarted +=
                (sender, args) => UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            _webView.LoadFinished +=
                (sender, args) => UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

            _webView.LoadError += (sender, args) =>
            {
                //Some providers have this strange Frame Interrupted Error :-/
                if (args.Error.Code == 102 && args.Error.Domain == "WebKitErrorDomain") return;

                _messageHub.Publish(new RequestTokenMessage(this) { TokenResponse = null });
            };

            View.AddSubview(_webView);

            _webView.LoadRequest(new NSUrlRequest(Url));
        }
开发者ID:JoseManuelLopez,项目名称:Cheesebaron.MvxPlugins,代码行数:29,代码来源:AccessControlWebAuthController.cs


示例5: HandleShouldStartLoad

        bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
        {
            // If the URL is not our own custom scheme, just let the webView load the URL as usual
            const string scheme = "hybrid:";

            if (request.Url.Scheme != scheme.Replace (":", ""))
                return true;

            // This handler will treat everything between the protocol and "?"
            // as the method name.  The querystring has all of the parameters.
            var resources = request.Url.ResourceSpecifier.Split ('?');
            var method = resources [0];
            var parameters = System.Web.HttpUtility.ParseQueryString (resources [1]);

            if (method == "UpdateLabel") {
                var textbox = parameters ["textbox"];

                // Add some text to our string here so that we know something
                // happened on the native part of the round trip.
                var prepended = string.Format ("C# says: {0}", textbox);

                // Build some javascript using the C#-modified result
                var js = string.Format ("SetLabelText('{0}');", prepended);

                webView.EvaluateJavascript (js);
            }

            return false;
        }
开发者ID:neurospeech,项目名称:app-core-ios,代码行数:29,代码来源:WebViewController.cs


示例6: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar();
            navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40);
            navBar.TintColor = UIColor.Gray;

            items = new [] {
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => {
                    webView.StopLoading ();
                    DismissViewController (true, null);
                }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => webView.Reload ())
            };

            navBar.Items = items;
            webView = new UIWebView ();
            webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);
            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            View.AddSubviews (new UIView[] { webView, navBar });
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:28,代码来源:WebViewController.cs


示例7: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			txt = new UITextView (new CoreGraphics.CGRect (100, 50, 200, 30));
			txt.BackgroundColor = UIColor.Gray;
			txt.TextColor = UIColor.White;
			txt.Text="https://auth.alipay.com/login/index.htm";

			UIButton btn = new UIButton (UIButtonType.System);
			btn.Frame = new CoreGraphics.CGRect (330, 50, 100, 30);
			btn.SetTitle ("GO", UIControlState.Normal);
			btn.TouchUpInside += Btn_TouchUpInside;

			UIButton btnHtmlString = new UIButton (UIButtonType.System);
			btnHtmlString.Frame = new CoreGraphics.CGRect (450, 50, 100, 30);
			btnHtmlString.SetTitle ("Html String", UIControlState.Normal);
			btnHtmlString.TouchUpInside += BtnHtmlString_TouchUpInside;

			UIButton btnFile = new UIButton (UIButtonType.System);
			btnFile.Frame = new CoreGraphics.CGRect (580, 50, 100, 30);
			btnFile.SetTitle ("Load File", UIControlState.Normal);
			btnFile.TouchUpInside += BtnFile_TouchUpInside;

			// Perform any additional setup after loading the view, typically from a nib.
			webView=new UIWebView(new CoreGraphics.CGRect(100,100,600,700));
			webView.ContentMode = UIViewContentMode.Center;
			
			this.View.AddSubviews (txt, btn, webView, btnHtmlString, btnFile);

		}
开发者ID:raisonzzy,项目名称:Xamarin-IOS,代码行数:30,代码来源:ViewController.cs


示例8: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar ();
            navBar.Frame = new RectangleF (0, this.View.Frame.Height-130, this.View.Frame.Width, 40);

            items = new UIBarButtonItem [] {
                new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }),
                new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); })
            };
            navBar.Items = items;

            SetNavBarColor();

            webView = new UIWebView ();
            webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-130);

            webView.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            webView.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            this.View.AddSubview (webView);
            this.View.AddSubview (navBar);
        }
开发者ID:ganeshan,项目名称:Monospace11,代码行数:34,代码来源:WebViewController.cs


示例9: collectDevice

        public static void collectDevice()
        {
            string SessionId = Conekta.DeviceFingerPrint ();
            string PublicKey = Conekta.PublicKey;
            string html = "<!DOCTYPE html><html><head></head><body style=\"background: blue;\">";
            html += "<script type=\"text/javascript\" src=\"https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js\" data-conekta-public-key=\"" + PublicKey + "\" data-conekta-session-id=\"" + SessionId + "\"></script>";
            html += "</body></html>";

            string contentPath = Environment.CurrentDirectory;

            #if __IOS__
            UIWebView web = new UIWebView(new RectangleF(new PointF(0,0), new SizeF(0, 0)));
            web.ScalesPageToFit = true;
            web.LoadHtmlString(html, new NSUrl("https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js"));
            Conekta._delegate.View.AddSubview(web);
            #endif

            #if __ANDROID__
            WebView web_view = new WebView(Android.App.Application.Context);
            web_view.Settings.JavaScriptEnabled = true;
            web_view.Settings.AllowContentAccess = true;
            web_view.Settings.DomStorageEnabled = true;
            web_view.LoadDataWithBaseURL(Conekta.UriConektaJs, html, "text/html", "UTF-8", null);
            #endif
        }
开发者ID:conekta,项目名称:conekta-xamarin,代码行数:25,代码来源:Conekta.cs


示例10: LoadView

        public override void LoadView()
        {
            base.LoadView ();

            bool isV7 = UIDevice.CurrentDevice.CheckSystemVersion (7, 0);

            View.BackgroundColor = UIColor.White;

            niceSegmentedCtrl = new SDSegmentedControl (new string [] { "Google", "Bing", "Yahoo" });

            if (isV7)
                niceSegmentedCtrl.Frame = new RectangleF (0, 10, 320, 44);
            else
                niceSegmentedCtrl.Frame = new RectangleF (0, 0, 320, 44);

            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("google"), 0);
            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("bicon"), 1);
            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("yahoo"), 2);
            niceSegmentedCtrl.ValueChanged += HandleValueChanged;

            if (isV7)
                browser = new UIWebView (new RectangleF (0, 55, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64));
            else
                browser = new UIWebView (new RectangleF (0, 45, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64));

            browser.LoadRequest (new NSUrlRequest ( new NSUrl ("http://google.com")));
            browser.AutosizesSubviews = true;

            View.AddSubviews ( new UIView[] { niceSegmentedCtrl, browser });
        }
开发者ID:amnextking,项目名称:monotouch-bindings,代码行数:30,代码来源:ViewController.cs


示例11: HandleShouldStartLoad

        bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
        {

            // If the URL is not our own custom scheme, just let the webView load the URL as usual
            var scheme = "app:";

            if (request.Url.Scheme != scheme.Replace(":", ""))
                return true;

            var resources = request.Url.ResourceSpecifier.Split('?');
            var method = resources[0];

            if (method == "QR")
            {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                scanner.Scan().ContinueWith(result => {
                    if (result != null){
                        var code = result.Result.Text;
                        this.InvokeOnMainThread(new NSAction(() => webView.LoadRequest(new NSUrlRequest(new NSUrl(MainUrl + "code?value=" + code)))));
                    }
                });
            }

            return false;
        }
开发者ID:artema,项目名称:hack4good,代码行数:25,代码来源:HybridViewController.cs


示例12: ViewDidLoad

		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			var webFrame = UIScreen.MainScreen.ApplicationFrame;

			_webView = new UIWebView(webFrame) {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
			};

			_webView.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
			};
			_webView.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			};
			_webView.LoadError += (webview, args) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
					_webView.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
			};

			View.AddSubview(_webView);

			_webView.LoadRequest(new NSUrlRequest(new NSUrl(ViewModel.Uri)));
		}
开发者ID:khellang,项目名称:Solvberget,代码行数:27,代码来源:GenericWebViewView.cs


示例13: FinishedLaunching

		public override bool FinishedLaunching (UIApplication application, NSDictionary options)
		{
			// Register our custom url protocol
			NSUrlProtocol.RegisterClass (new ObjCRuntime.Class (typeof (ImageProtocol)));

			controller = new UIViewController ();

			web = new UIWebView () {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.All
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0))
				web.Frame = new CGRect (0, 20,
				                            UIScreen.MainScreen.Bounds.Width,
				                            UIScreen.MainScreen.Bounds.Height - 20);
			else
				web.Frame = UIScreen.MainScreen.Bounds;
			controller.NavigationItem.Title = "Test case";

			controller.View.AutosizesSubviews = true;
			controller.View.AddSubview (web);

			web.LoadRequest (NSUrlRequest.FromUrl (NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("test", "html"))));

			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.BackgroundColor = UIColor.White;
			window.MakeKeyAndVisible ();
			window.RootViewController = controller;

			return true;
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:32,代码来源:AppDelegate.cs


示例14: Create

        public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
        {
            var view = BaseItemView.Create(frame, nodeViewController, node, kleur);
            UIWebView webView = new UIWebView();

			string extension = Path.GetExtension (filePath);
			if (extension == ".odt") {
				string viewerPath = NSBundle.MainBundle.PathForResource ("over/viewer/index", "html");

				Uri fromUri = new Uri(viewerPath);
				Uri toUri = new Uri(filePath);
				Uri relativeUri = fromUri.MakeRelativeUri(toUri);
				String relativePath = Uri.UnescapeDataString(relativeUri.ToString());

				NSUrl finalUrl = new NSUrl ("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			} else {
				NSUrl finalUrl = new NSUrl (filePath, false);
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			}
		
        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:30,代码来源:WebItemView.cs


示例15: RowSelected

        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            var webViewController = new UIViewController ();
            var button = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Plain, null);

            var custom = new UIButton (new RectangleF (0, 0, 26, 15));
            custom.SetBackgroundImage(UIImage.FromFile("./Assets/back.png"), UIControlState.Normal);
            custom.TouchUpInside += (sender, e) => webViewController.NavigationController.PopViewControllerAnimated (true);
            button.CustomView = custom;
            webViewController.NavigationItem.LeftBarButtonItem = button;

            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            spinner.Center = new PointF (160, 160);
            spinner.HidesWhenStopped = true;

            var webView = new UIWebView (tableView.Bounds);
            webView.Opaque = false;
            webView.BackgroundColor = UIColor.Black;
            webView.AddSubview (spinner);
            spinner.StartAnimating ();
            webView.LoadRequest (new NSUrlRequest (new NSUrl (string.Format(RequestConfig.Video, items[indexPath.Row].Id))));
            webViewController.View = webView;
            webViewController.Title = items[indexPath.Row].Category;
            webView.LoadFinished += (object sender, EventArgs e) => {
                spinner.StopAnimating();
            };

            ((MainTabController)UIApplication.SharedApplication.Delegate.Window.RootViewController).
                Video.InternalTopNavigation.PushViewController (webViewController,true);

            tableView.DeselectRow (indexPath, true);
        }
开发者ID:jgrozdanov,项目名称:mono-sport,代码行数:32,代码来源:VideoControllerSource.cs


示例16: SetupUserInterface

		private void SetupUserInterface ()
		{
			scrollView = new UIScrollView {
				BackgroundColor = UIColor.Clear.FromHexString ("#094074", 1.0f),
				Frame = new CGRect (0, 0, Frame.Width, Frame.Height * 2)
			};

			licensureLabel = new UILabel {
				Font = UIFont.FromName ("SegoeUI-Light", 25f),
				Frame = new CGRect (0, 20, Frame.Width, 35),
				Text = "Open-Source",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.White
			};

			string localHtmlUrl = Path.Combine (NSBundle.MainBundle.BundlePath, "Licensure.html");
			var url = new NSUrl (localHtmlUrl, false);
			var request = new NSUrlRequest (url);

			webView = new UIWebView () {
				Frame = new CGRect (0, 55, Frame.Width, Frame.Height - 55)
			};
			webView.LoadRequest (request);

			scrollView.ContentSize = new CGSize (Frame.Width, Frame.Height * 2);

			scrollView.Add (licensureLabel);
			scrollView.Add (webView);
			Add (scrollView);
		}
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:30,代码来源:LicensureView.cs


示例17: WebAuthenticatorController

		public WebAuthenticatorController (WebAuthenticator authenticator)
		{
			this.authenticator = authenticator;

			authenticator.Error += HandleError;
			authenticator.BrowsingCompleted += HandleBrowsingCompleted;

			//
			// Create the UI
			//
			Title = authenticator.Title;

			NavigationItem.LeftBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Cancel,
				delegate {
					Cancel ();
				});

			activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White);
			NavigationItem.RightBarButtonItem = new UIBarButtonItem (activity);

			webView = new UIWebView (View.Bounds) {
				Delegate = new WebViewDelegate (this),
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
			};
			View.AddSubview (webView);
			View.BackgroundColor = UIColor.Black;

			//
			// Locate our initial URL
			//
			BeginLoadingInitialUrl ();
		}
开发者ID:bwatkins79,项目名称:Xamarin.Auth,代码行数:33,代码来源:WebAuthenticatorController.cs


示例18: AudioSelected

        public static UIViewController AudioSelected(ApiNode apiNode)
        {
            var url = apiNode["videoSrc1"];

            if (apiNode["contentNode"] != null)
            {
                url = apiNode[apiNode["contentNode"]];
            }

            //var videoController = new UIVideoController(url);

            //videoController.NavigationItem.Title = apiNode.Title;

            //return videoController;

            var vc = new UIViewController();

            var webView = new UIWebView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.White,
                ScalesPageToFit = true,
                AutoresizingMask = UIViewAutoresizing.All
            };

            var request = new NSUrlRequest(new NSUrl(url), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60);

            webView.LoadRequest(request);

            vc.NavigationItem.Title = apiNode.Title;

            vc.View.AutosizesSubviews = true;
            vc.View.AddSubview(webView);

            return vc;
        }
开发者ID:josiahpeters,项目名称:CCBoise,代码行数:35,代码来源:ApiVideoElement.cs


示例19: SaveAndLaunchFile

        public Task SaveAndLaunchFile(Stream stream, string fileType)
        {
            if (OriginView == null) return Task.FromResult(true);

            var data = NSData.FromStream(stream);
            var width = 824;
            var height = 668;

            var popoverView = new UIView(new RectangleF(0, 0, width, height));
            popoverView.BackgroundColor = UIColor.White;
            var webView = new UIWebView();
            webView.Frame = new RectangleF(0, 45, width, height - 45);

            var b = new UIButton(UIButtonType.RoundedRect);
            b.SetTitle("Done", UIControlState.Normal);
            b.Frame = new RectangleF(10,10, 60, 25);
            b.TouchUpInside += (o, e) => _popoverController.Dismiss(true);

            popoverView.AddSubview(b);
            popoverView.AddSubview(webView);

            var bundlePath = NSBundle.MainBundle.BundlePath;
            System.Diagnostics.Debug.WriteLine(bundlePath);
            webView.LoadData(data, "application/pdf", "utf-8", NSUrl.FromString("http://google.com"));

            var popoverContent = new UIViewController();
            popoverContent.View = popoverView;

            _popoverController = new UIPopoverController(popoverContent);
            _popoverController.PopoverContentSize = new SizeF(width, height);
            _popoverController.PresentFromRect(new RectangleF(OriginView.Frame.Width/2, 50, 1, 1), OriginView, UIPopoverArrowDirection.Any, true);
            _popoverController.DidDismiss += (o, e) => _popoverController = null;

            return Task.FromResult(true);
        }
开发者ID:reactiveui-forks,项目名称:VirtualSales,代码行数:35,代码来源:PlatformServices.cs


示例20: HtmlSelected

        public static UIViewController HtmlSelected(ApiNode apiNode)
        {
            var vc = new UIViewController();

            var webView = new UIWebView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.White,
                ScalesPageToFit = false,
                AutoresizingMask = UIViewAutoresizing.All
            };

            var html = apiNode["content"];

            if (apiNode["contentNode"] != null)
            {
                html = apiNode[apiNode["contentNode"]];
            }

            if (html != null && !html.Contains("<html"))
            {
                html = String.Format("<html><head><link href=\"main-style.css\" rel=\"stylesheet\" type=\"text/css\" /></head><body><h1>{0}</h1>{1}</body><html>", apiNode.Title, html);
            }

            if (html != null)
                webView.LoadHtmlString(html, new NSUrl("HtmlContent/", true));

            vc.NavigationItem.Title = apiNode.Title;

            vc.View.AutosizesSubviews = true;
            vc.View.AddSubview(webView);

            return vc;
        }
开发者ID:josiahpeters,项目名称:CCBoise,代码行数:33,代码来源:ApiVideoElement.cs



注:本文中的UIWebView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UIWidget类代码示例发布时间:2022-05-24
下一篇:
C# UIViewController类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap