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


C# UIWebView.SizeToFit方法代码示例

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


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

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

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

示例3: ViewDidLoad

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

			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 (); 
					
					// Phone: NavigationController, Pad: Modal
					if (NavigationController == null)
						DismissViewController (true, ()=> {});
					else
						NavigationController.PopViewController (true);
				})
			};

			navBar.Items = items;
			
			webView = new UIWebView ();
			if (AppDelegate.IsPhone)
				webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);
			else
				webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);

			webView.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
				navBar.Items[0].Enabled = webView.CanGoBack;
				navBar.Items[1].Enabled = webView.CanGoForward;
			};
			webView.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				navBar.Items[0].Enabled = webView.CanGoBack;
				navBar.Items[1].Enabled = webView.CanGoForward;
			};
			
			webView.ScalesPageToFit = true;
			webView.SizeToFit ();
			webView.LoadRequest (url);
			
			navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
			webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

			View.AddSubview (webView);
			View.AddSubview (navBar);
		}
开发者ID:topcbl,项目名称:mobile-samples,代码行数:55,代码来源:WebViewController.cs

示例4: ViewDidLoad

 public override void ViewDidLoad()
 {
     base.ViewDidLoad ();
     basedir = Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
     basedir = System.IO.Path.Combine(basedir, "..", "iOS.app"); // HACK: bad bad bad
     Console.WriteLine ("~~~"+System.Environment.CurrentDirectory);
     // no XIB !
     webView = new UIWebView()
     {
         ScalesPageToFit = false,
     };
     LoadHtmlString(FormatText());
     webView.SizeToFit();
     webView.Frame = new RectangleF (0, topPosition, this.View.Frame.Width, this.View.Frame.Height-44);
     // Add the table view as a subview
     this.View.AddSubview(webView);
 }
开发者ID:joshua-davis8,项目名称:MonkeySpace,代码行数:17,代码来源:WebViewControllerBase.cs

示例5: ViewDidLoad

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

            _web = new UIWebView {
                ScalesPageToFit = false,
                Opaque = false,
                BackgroundColor = UIColor.White,
                MultipleTouchEnabled = true,
                Frame = new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height-80),
            };

            _web.Delegate = new WebViewDelegate();

            _web.SizeToFit();

            this.View.AddSubview(_web);
        }
开发者ID:kevinmcmahon,项目名称:CCC,代码行数:18,代码来源:TentDetailViewController.cs

示例6: ViewDidLoad

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

            webView = new UIWebView { ScalesPageToFit = true };

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

            webView.LoadHtmlString(FormatText(), new NSUrl());
            webView.SizeToFit();
            webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height - 44);
            this.View.AddSubview(webView);
        }
开发者ID:NotMyself,项目名称:BigRReader,代码行数:18,代码来源:RssFeedItemViewController.cs

示例7: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // no XIB !
            webView = new UIWebView()
            {
                ScalesPageToFit = false
            };
            webView.LoadHtmlString(FormatText(), new NSUrl());

            // Set the web view to fit the width of the app.
            webView.SizeToFit();

            // Reposition and resize the receiver
            webView.Frame = new RectangleF (0, 0, this.View.Bounds.Width, this.View.Bounds.Height);

            // Add the table view as a subview
            this.View.AddSubview(webView);
        }
开发者ID:conceptdev,项目名称:Facebook,代码行数:19,代码来源:PostViewController.cs

示例8: ViewDidLoad

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

            _view = new UIView();
            _view.BackgroundColor = UIColor.GroupTableViewBackgroundColor;

            UILabel label = new UILabel();
            label.Text = _stopInfo.StopName;
            label.BackgroundColor = UIColor.GroupTableViewBackgroundColor;
            label.SizeToFit();
            label.Frame = new RectangleF(10,0, 300, 40);

            _view.Add(label);

            UIButton button = UIButton.FromType(UIButtonType.RoundedRect);
            button.SetTitle("Legg til i favoritter", UIControlState.Normal);;

            button.Frame = new RectangleF(10, 120, 150, 50);

            _view.Add(button);

            _view.SizeToFit();

            button.TouchUpInside += delegate {
                _busStopRepository.AddFavorite(_stopInfo);
            };

            webView = new UIWebView { ScalesPageToFit = false };

            webView.LoadHtmlString (FormatText (), new NSUrl ());

            // Set the web view to fit the width of the app.
            webView.SizeToFit ();

            // Reposition and resize the receiver
            _view.Frame = new RectangleF (0, 0, this.View.Bounds.Width, this.View.Bounds.Height);

            // Add the table view as a subview
            this.View.AddSubview (_view);
        }
开发者ID:runegri,项目名称:MuPP,代码行数:41,代码来源:BusStopViewController.cs

示例9: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // no XIB !
            webView = new UIWebView()
            {
                ScalesPageToFit = false
            };

            basedir = Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
            basedir = basedir.Replace("Documents", "PDC09.app");

            webView.LoadHtmlString(FormatText(), null);//new NSUrl(basedir+"/Sponsors/", true));

            // Set the web view to fit the width of the app.
            webView.SizeToFit();

            // Reposition and resize the receiver
            webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-90);

            // Add the table view as a subview
            this.View.AddSubview(webView);
        }
开发者ID:GunioRobot,项目名称:PDC09,代码行数:23,代码来源:SponsorsViewController.cs

示例10: AddWebView

        protected void AddWebView()
        {
            //			Font = UIFont.FromName ("OpenSans", 14),
            //				TextColor = UIColor.FromRGB (67, 67, 67),
            //				TextAlignment = UITextAlignment.Left,
            //				BackgroundColor = UIColor.Clear,
            //				Text = '<a href="http://mydiem.com/index.cfm?event=main.faq">Help</a><br/><a href="mailto:[email protected]">Email Support</a>',
            //				LineBreakMode = UILineBreakMode.WordWrap,
            //				Lines = 0
            var style = "<style type='text/css'>body { color: #000000; background-color: transparent; font-family: 'HelveticaNeue-Light', Helvetica, Arial, sans-serif; padding: 20px; } h1, h2, h3, h4, h5, h6 { padding: 0px; margin: 0px; font-style: normal; font-weight: normal; } h2 { font-family: 'HelveticaNeue-Light', Helvetica, Arial, sans-serif; font-size: 24px; font-weight: normal; } h4 { font-size: 16px; } p { font-family: Helvetica, Verdana, Arial, sans-serif; line-height:1.5; font-size: 16px; } .esv-text { padding: 0 0 10px 0; }</style>";
            var html = style + "<body><h2>Contact</h2><a href='http://mydiem.com/index.cfm?event=main.faq'>Help</a><br/><a href='mailto:[email protected]'>Email Support</a><br/><br/>";
            html += "<h2>Our Story</h2><p>If you've ever sent your child empty-handed to a class party, attended parent/teacher conferences on the wrong day or arrived an hour early for a game, you're not alone. It's not bad parenting, it's bad scheduling and trust us, we've been there too.</p><p>Year after year we would receive paper calendars from our children's schools, get several emails a week, or would be encouraged to visit websites to view upcoming events (sports teams, Boy Scouts/ Girl Scouts, ballet, band and track club all had different sites!). Sometimes we would enter the information into a paper agenda, which couldn't be shared. Or we would type everything into our computer's calendar hoping the information wouldn't change. And, as the school year progressed, updates would take the form of crumpled notes, skimmed over emails and hurried messages from coaches and teachers that didn't always make it to the master calendar. We'd often ask ourselves, \"Why can't school events appear on our smart phones or computer calendar programs?\" or \"If there is a change, couldn't someone update the calendar for us so we don't have to keep track of emails, notes, etc? Then, one day, we stopped wishing and got to work.</p><p>We are parents to three school-age (and very busy) children and now we\'re also the proud parents of MyDiem.com. We're so happy to share this much-needed tool with other busy parents. Hopefully you will find this tool helpful in keeping track of your child's activities.</p>";
            html += "</body>";

            webViewTest = new UIWebView (new RectangleF (0, 0, 320, WhitePaperBible.iOS.UI.Environment.DeviceScreenHeight));
            webViewTest.SizeToFit ();
            View.AddSubview (webViewTest);

            webViewTest.Opaque = false;
            webViewTest.BackgroundColor = UIColor.Clear;
            webViewTest.LoadHtmlString (html, NSUrl.FromString ("http://localhost"));

            //			DescriptionLabel.ShouldStartLoad = myHandler;
        }
开发者ID:davidortinau,项目名称:WhitePaperBibleMono,代码行数:24,代码来源:PaperDetailsView.cs

示例11: ViewDidLoad

 public override void ViewDidLoad()
 {
     base.ViewDidLoad ();
     basedir = Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
     basedir = basedir.Replace("Documents", "Monospace11.app");
     // no XIB !
     webView = new UIWebView()
     {
         ScalesPageToFit = false,
     };
     LoadHtmlString(FormatText());
     webView.SizeToFit();
     webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-93);
     // Add the table view as a subview
     this.View.AddSubview(webView);
 }
开发者ID:ganeshan,项目名称:Monospace11,代码行数:16,代码来源:WebViewControllerBase.cs


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