当前位置: 首页>>代码示例>>C#>>正文


C# UIWebView.LoadRequest方法代码示例

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


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

示例1: 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

示例2: ViewDidLoad

		public override void ViewDidLoad ()
		{
			Title = "Web";
			NavigationController.NavigationBar.Translucent = false;
			var webFrame = UIScreen.MainScreen.ApplicationFrame;
			webFrame.Y += 25f;
			webFrame.Height -= 40f;

			web = new UIWebView (webFrame) {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
			};
			web.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
			};
			web.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			};
			web.LoadError += (webview, args) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
			};
			View.AddSubview (web);

			// Delegate = new
			var urlField = new UITextField (new CGRect (20f, 10f, View.Bounds.Width - (20f * 2f), 30f)){
				BorderStyle = UITextBorderStyle.Bezel,
				TextColor = UIColor.Black,
				Placeholder = "<enter a URL>",
				Text = "http://ios.xamarin.com/",
				BackgroundColor = UIColor.White,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
				ReturnKeyType = UIReturnKeyType.Go,
				KeyboardType = UIKeyboardType.Url,
				AutocapitalizationType = UITextAutocapitalizationType.None,
				AutocorrectionType = UITextAutocorrectionType.No,
				ClearButtonMode = UITextFieldViewMode.Always
			};

			urlField.ShouldReturn = delegate (UITextField field){
				field.ResignFirstResponder ();
				web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl (field.Text)));

				return true;
			};

			View.AddSubview (urlField);

			web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl ("http://ios.xamarin.com/")));
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:51,代码来源:WebViewController.xib.cs

示例3: 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

示例4: ViewDidLoad

		public override void ViewDidLoad()
		{
			base.ViewDidLoad ();
			View.BackgroundColor = UIColor.White;

			var TitleFrame = new CGRect (0, 15, View.Frame.Width, 50);
			var DisclaimerTitleLabel = new UILabel (TitleFrame) {
				Font = UIFont.FromName("HelveticaNeue-Medium", 14f),
				Text = "Disclosures",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
			};

			DisclaimerCloseButton.TintColor = UIColor.Clear.FromHexString (RSColors.MM_BLUE);

			DisclaimerCloseButton.TouchUpInside += (object sender, EventArgs e) => {
				this.DismissViewController(true, null);
			};

			var DisclaimerFrame = new CGRect (15f, 60f, View.Frame.Width - 30f, View.Frame.Height-60f);
			var DisclaimerWebView = new UIWebView (DisclaimerFrame);

			DisclaimerWebView.LoadRequest (new NSUrlRequest (new NSUrl (UrlConsts.URL_DISCLAIMERS)));

			View.AddSubview (DisclaimerTitleLabel);
			View.AddSubview (DisclaimerWebView);
		}
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:27,代码来源:RSDisclaimersViewController.cs

示例5: 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

示例6: 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

示例7: ViewDidLoad

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

            Title = "WebView";
            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);

            // html, image, css files must have Build Action:Content
            string fileName = "Content/Home.html"; // remember case sensitive

            string localHtmlUrl = Path.Combine(NSBundle.MainBundle.BundlePath, fileName);
            webView.LoadRequest (new NSUrlRequest (new NSUrl (localHtmlUrl, false)));
            webView.ScalesPageToFit = true;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            #region Additional Info
            // can also manually create html
            // passing the 'base' path to LoadHtmlString lets relative Urls for for links, images, etc
            //string contentDirectoryPath = Path.Combine(NSBundle.MainBundle.BundlePath,"Content/");
            //webView.LoadHtmlString ("<html><a href='Home.html'>Click Me</a>", new NSUrl (contentDirectoryPath, true));
            #endregion
        }
开发者ID:yofanana,项目名称:recipes,代码行数:25,代码来源:WebViewController.cs

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var webView = new UIWebView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height));
            View.Add (webView);
            webView.LoadRequest (new NSUrlRequest (new NSUrl(_url)));

            // Perform any additional setup after loading the view, typically from a nib.
        }
开发者ID:ferrodox,项目名称:knowledges-sharing,代码行数:9,代码来源:DetailsController.cs

示例13: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			webView = new UIWebView (View.Bounds);
			View.AddSubview(webView);
			string url = "http://fixbuy.mx/products/new?bar_code="+ProductStoresListView.barcode2;
			webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));
			webView.ScalesPageToFit = true;
		}
开发者ID:saedaes,项目名称:ProductFinder,代码行数:9,代码来源:LoadNewProductView.cs

示例14: ViewDidLoad

        public override void ViewDidLoad()
        {
            var webView = new UIWebView(View.Bounds);

            webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

            webView.ScalesPageToFit = true;

            View.AddSubview(webView);
        }
开发者ID:chrisMartha,项目名称:HackerNewsNow,代码行数:10,代码来源:EntryViewController.cs

示例15: FileDetailViewController

 public FileDetailViewController(string filePath)
 {
     var webView = new UIWebView(new RectangleF(0.0f, -44.0f, 320.0f, 460.0f));
     webView.ScalesPageToFit = true;
     webView.ScrollView.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor;
     webView.LoadRequest(new NSUrlRequest(new NSUrl(filePath, false)));
     this.View = webView;
     this.SetToolbarItems(AppDelegate.ToolbarButtons, false);
     this.NavigationItem.Title = Path.GetFileName(filePath);
 }
开发者ID:narent,项目名称:AirFolio,代码行数:10,代码来源:FileDetailViewController.cs


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