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


C# UIScrollView.AddSubview方法代码示例

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


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

示例1: ViewDidLoad

        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            nameLabel = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt),
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };
            descriptionTextView = new UITextView () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt),
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f),
                Editable = false
            };
            image = new UIImageView () { ContentMode = UIViewContentMode.ScaleAspectFit };

            if (AppDelegate.IsPad) {
                View.AddSubview (nameLabel);

                View.AddSubview (descriptionTextView);
                View.AddSubview (image);
            } else {
                scrollView = new UIScrollView();

                scrollView.AddSubview (nameLabel);

                scrollView.AddSubview (descriptionTextView);
                scrollView.AddSubview (image);

                Add (scrollView);
            }
        }
开发者ID:kenibarwick,项目名称:ComDayBe2013,代码行数:32,代码来源:UserGroupDetailsScreen.cs

示例2: LayoutSubviews

		public override void LayoutSubviews ()
		{
			// layout the stock UIAlertView control
			base.LayoutSubviews ();
			
			if(this.Subviews.Count() == 3)
			{
				// build out the text field
				_UserName = ComposeTextFieldControl (false);
				_Password = ComposeTextFieldControl (true);

				// add the text field to the alert view
				
				UIScrollView view = new UIScrollView(this.Frame);
				
				view.AddSubview(ComposeLabelControl("Username"));
				view.AddSubview (_UserName);
				view.AddSubview(ComposeLabelControl("Password"));
				view.AddSubview (_Password);
				
				this.AddSubview(view);
				
			}
			
			// shift the contents of the alert view around to accomodate the extra text field
			AdjustControlSize ();
			
		}
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:28,代码来源:UIPopupLoginView.cs

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;
            Title = "Main info";

            var scrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height))
            {
                ScrollEnabled = true,
                ContentSize = new CGSize(View.Bounds.Size.Width, View.Bounds.Size.Height),
                AutoresizingMask = UIViewAutoresizing.FlexibleDimensions
            };
            View.AddSubview(scrollView);

            using (var set = new BindingSet<OrderEditorViewModel>())
            {
                UIFont font = UIFont.SystemFontOfSize(12);

                var label = new UILabel(new CGRect(20, 0, View.Frame.Width - 40, 25))
                {
                    Text = "Name",
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                    Font = font
                };
                scrollView.AddSubview(label);

                var textField = new UITextField(new CGRect(20, 25, View.Frame.Width - 40, 30))
                {
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                    BorderStyle = UITextBorderStyle.RoundedRect,
                };
                set.Bind(textField)
                    .To(() => (vm, ctx) => vm.Name)
                    .TwoWay()
                    .Validate();
                scrollView.AddSubview(textField);


                label = new UILabel(new CGRect(20, 55, View.Frame.Width - 40, 25))
                {
                    Text = "Number",
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                    Font = font
                };
                scrollView.AddSubview(label);

                textField = new UITextField(new CGRect(20, 80, View.Frame.Width - 40, 30))
                {
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                    BorderStyle = UITextBorderStyle.RoundedRect
                };
                set.Bind(textField)
                    .To(() => (vm, ctx) => vm.Number)
                    .TwoWay()
                    .Validate();
                scrollView.AddSubview(textField);
            }
        }
开发者ID:Fezzer,项目名称:MugenMvvmToolkit.Samples,代码行数:58,代码来源:OrderInfoEditorViewController.cs

示例4: SpeakerDetailsScreen

		public SpeakerDetailsScreen (int speakerID) : base()
		{
			ShouldShowSessions = true;

			speakerId = speakerID;

			View.BackgroundColor = UIColor.White;
			
			if (AppDelegate.IsPad) {
				toolbar = new UIToolbar (new RectangleF(0,0,UIScreen.MainScreen.Bounds.Width, 40));
				
				View.AddSubview (toolbar);
				y = 40;
			}

			nameLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt),
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			titleLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = UIFont.FromName ("Helvetica-LightOblique", AppDelegate.Font10pt),
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			companyLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10pt),
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			 bioTextView = new UITextView () {
				TextAlignment = UITextAlignment.Left,
				Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt),
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f),
				ScrollEnabled = true,
				Editable = false
			};
			image = new UIImageView();

			
			scrollView = new UIScrollView();

			scrollView.AddSubview (nameLabel);
			scrollView.AddSubview (titleLabel);
			scrollView.AddSubview (companyLabel);
			scrollView.AddSubview (bioTextView);
			scrollView.AddSubview (image);	

			Add (scrollView);	
		}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:52,代码来源:SpeakerDetailsScreen.cs

示例5: FinishedLaunching

        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            UIApplication.SharedApplication.SetStatusBarHidden(true, true);

            var scrollView = new UIScrollView(window.Bounds);
            window.AddSubview(scrollView);

            var view = new HypnosisView() { Frame = window.Bounds };

            scrollView.AddSubview(view);
            scrollView.ContentSize = window.Bounds.Size;

            scrollView.MinimumZoomScale = 1.0f;
            scrollView.MaximumZoomScale = 5.0f;
            scrollView.Delegate = new HSAnonScrollViewerDelegate(sv => {
                return view;
            });

            window.BackgroundColor = UIColor.White;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
开发者ID:paulcbetts,项目名称:BigNerdIOS-MonoDevelop,代码行数:34,代码来源:AppDelegate.cs

示例6: PdfViewController

		public PdfViewController (NSUrl url) : base()
		{
			Url = url;
			View = new UIView ();
			View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
			View.AutosizesSubviews = true;
			
			PdfDocument = CGPDFDocument.FromUrl (Url.ToString ());
			
			// For demo purposes, show first page only.
			PdfPage = PdfDocument.GetPage (1);
			PdfPageRect = PdfPage.GetBoxRect (CGPDFBox.Crop);
			
			// Setup tiled layer.
			TiledLayer = new CATiledLayer ();
			TiledLayer.Delegate = new TiledLayerDelegate (this);
			TiledLayer.TileSize = new SizeF (1024f, 1024f);
			TiledLayer.LevelsOfDetail = 5;
			TiledLayer.LevelsOfDetailBias = 5;
			TiledLayer.Frame = PdfPageRect;
			
			ContentView = new UIView (PdfPageRect);
			ContentView.Layer.AddSublayer (TiledLayer);
			
			// Prepare scroll view.
			ScrollView = new UIScrollView (View.Frame);
			ScrollView.AutoresizingMask = View.AutoresizingMask;
			ScrollView.Delegate = new ScrollViewDelegate (this);
			ScrollView.ContentSize = PdfPageRect.Size;
			ScrollView.MaximumZoomScale = 10f;
			ScrollView.MinimumZoomScale = 1f;
			ScrollView.ScrollEnabled = true;
			ScrollView.AddSubview (ContentView);
			View.AddSubview (ScrollView);
		}
开发者ID:21Off,项目名称:21Off,代码行数:35,代码来源:PdfViewController.cs

示例7: ViewDidLoad

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

			// set the background color of the view to white
			View.BackgroundColor = UIColor.White;

			Title = "Scroll View";

			imageView = new UIImageView (UIImage.FromFile ("Images/halloween.jpg"));

			// create our scroll view
			var frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height);
			scrollView = new UIScrollView (frame) {
				ContentSize = imageView.Image.Size,
				MaximumZoomScale = 3f,
				MinimumZoomScale = .1f
			};
			scrollView.AddSubview (imageView);
			View.AddSubview (scrollView);

			scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => {
				return imageView;
			};
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:25,代码来源:Controller.cs

示例8: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// set the background color of the view to white
			this.View.BackgroundColor = UIColor.White;
			
			this.Title = "Scroll View";
			
			// create our scroll view
			scrollView = new UIScrollView (
				new CGRect (0, 0, View.Frame.Width
				, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
			View.AddSubview (scrollView);
			
			// create our image view
			imageView = new UIImageView (UIImage.FromFile ("halloween.jpg"));
			scrollView.ContentSize = imageView.Image.Size;
			scrollView.AddSubview (imageView);
			
			// set allow zooming
			scrollView.MaximumZoomScale = 3f;
			scrollView.MinimumZoomScale = .1f;			
			scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };

			// Create a new Tap Gesture Recognizer
			UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) {
				NumberOfTapsRequired = 2 // double tap
			};
			scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped
		}
开发者ID:eduardoguilarducci,项目名称:recipes,代码行数:31,代码来源:ScrollViewController.cs

示例9: ViewDidLoad

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

            scrollView = new UIScrollView (
                new RectangleF (0, 0, View.Frame.Width,
                    View.Frame.Height));
            View.AddSubview (scrollView);

            imageView = new UIImageView (UIImage.FromBundle ("heinz-map.png"));

            scrollView.ContentSize = imageView.Image.Size;
            scrollView.AddSubview (imageView);
            scrollView.MaximumZoomScale = 0.7f;
            scrollView.MinimumZoomScale = 0.4f;
            scrollView.ContentOffset = new PointF (0, 500);
            scrollView.ZoomScale = 5f;
            scrollView.ViewForZoomingInScrollView += (UIScrollView svm) => {
                return imageView;
            };

            UITapGestureRecognizer doubletap =  new UITapGestureRecognizer(OnDoubleTap) {
                NumberOfTapsRequired = 2 // double tap
            };
            scrollView.AddGestureRecognizer(doubletap);
        }
开发者ID:cdmedia,项目名称:heinzight,代码行数:26,代码来源:MapViewController.cs

示例10: ViewDidLoad

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

            Title = AppDelegate.its.getTranslatedText ("Help");

            Background back = new Background ();
            this.View.AddSubview (back.View);
            this.View.SendSubviewToBack (back.View);

            if (AppDelegate.Variant == "LITE") {
                adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, 66)) {
                    AdUnitID = AppDelegate.AdmobID,
                    RootViewController = this
                };

                adView.DidReceiveAd += (sender, args) => {
                    if (!viewOnScreen) View.AddSubview (adView);
                    viewOnScreen = true;
                };

                adView.LoadRequest (GADRequest.Request);
            }

            HelpScreenInner innerViewController = new HelpScreenInner ();
            UIScrollView innerScroll = new UIScrollView (View.Bounds);
            innerScroll.ContentSize = innerViewController.GetContentSize ();
            innerScroll.AddSubview (innerViewController.View);
            innerScroll.UserInteractionEnabled = true;
            View.AddSubview (innerScroll);

            UIBarButtonItem YouTube = new UIBarButtonItem ("YouTube", UIBarButtonItemStyle.Plain, null);
            YouTube.Clicked += (object sender, System.EventArgs e) => UIApplication.SharedApplication.OpenUrl (new MonoTouch.Foundation.NSUrl ("https://www.youtube.com/watch?v=aq1Ml2O8ado"));
            this.NavigationItem.SetRightBarButtonItem (YouTube,true);
        }
开发者ID:KuroiAme,项目名称:Indexer,代码行数:35,代码来源:HelpScreen.cs

示例11: ViewDidLoad

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

            _canvasView = new UIView
            {
                BackgroundColor = CanvasBackgroundColor,
                Bounds = new CGRect(CGPoint.Empty, CanvasSize),
            };

            _scrollView = new UIScrollView()
            {
                ContentSize = CanvasSize,
                ViewForZoomingInScrollView = sv => _canvasView,
                BackgroundColor = ScrollViewBackgroundColor,
            };

            _scrollView.AddSubview(_canvasView);

            View.AddSubview(_scrollView);

            AddGestures();

            AddInitialElements();
        }
开发者ID:TheRealAdamKemp,项目名称:GestureRecognizerPresentation,代码行数:25,代码来源:GestureViewController.cs

示例12: ViewDidLoad

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

            float h = 50.0f;
            float w = 50.0f;
            float padding = 10.0f;
            int n = 25;

            _scrollView = new UIScrollView {
                Frame = new RectangleF (0, 0, View.Frame.Width, h + 2 * padding),
                ContentSize = new SizeF ((w + padding) * n, h),
                BackgroundColor = UIColor.DarkGray,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth
            };

            for (int i=0; i<n; i++) {
                var button = UIButton.FromType (UIButtonType.RoundedRect);
                button.SetTitle (i.ToString (), UIControlState.Normal);
                button.Frame = new RectangleF (padding * (i + 1) + (i * w), padding, w, h);
                _scrollView.AddSubview (button);
                _buttons.Add (button);
            }

            View.AddSubview (_scrollView);
        }
开发者ID:omxeliw,项目名称:recipes,代码行数:26,代码来源:ScrollingButtonsController.cs

示例13: LoadView

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

            this.View.Layer.BackgroundColor = ColorScheme.Clouds.CGColor;

            SearchButton = new UIButton();
            holderView = new UIView(this.View.Frame);
            SearchTableView = new UITableView(new CGRect(), UITableViewStyle.Grouped);
            scrollView = new UIScrollView(this.View.Frame);
            SearchCityLabel = new UILabel { TextAlignment = UITextAlignment.Center };
            SearchCityLabel.AttributedText = new NSAttributedString(String.Format("Search {0} for:", Location.SiteName), Constants.LabelAttributes);

            ads = new ADBannerView();

            SearchButton.Layer.BackgroundColor = ColorScheme.MidnightBlue.CGColor;
            SearchButton.Layer.CornerRadius = 10;
            SearchButton.ClipsToBounds = true;
            SearchButton.SetAttributedTitle(new NSAttributedString("Search", Constants.ButtonAttributes), UIControlState.Normal);

            SearchTableView.Layer.BackgroundColor = ColorScheme.Clouds.CGColor;

            holderView.AddSubviews(new UIView[] { SearchButton, SearchCityLabel, SearchTableView, ads });
            scrollView.AddSubview(holderView);
            this.View.AddSubview(scrollView);

            AddLayoutConstraints();

            saveButton = new UIBarButtonItem(
                UIImage.FromFile("save.png"),
                UIBarButtonItemStyle.Plain,
                SaveButtonClicked);

            NavigationItem.RightBarButtonItem = saveButton;
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:35,代码来源:SearchViewController.cs

示例14: ViewDidLoad

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

             // set the background color of the view to white
             this.View.BackgroundColor = UIColor.White;

             this.Title = "Mecut Dosya";

             // create our scroll view
             scrollView = new UIScrollView (
            new RectangleF (0, 0, View.Frame.Width
               , View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
             View.AddSubview (scrollView);

             string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
             string localFilename = "original.jpg";
             string localPath = Path.Combine(documentsPath, localFilename);

             // create our image view
             imageView = new UIImageView (UIImage.FromFile (localPath));
             scrollView.ContentSize = imageView.Image.Size;
             scrollView.AddSubview (imageView);

             // set allow zooming
             scrollView.MaximumZoomScale = 3f;
             scrollView.MinimumZoomScale = .1f;
             scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };

             // configure a double-tap gesture recognizer
             UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
             doubletap.NumberOfTapsRequired = 2;
             doubletap.AddTarget (this, new MonoTouch.ObjCRuntime.Selector("DoubleTapSelector"));
             scrollView.AddGestureRecognizer(doubletap);
        }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:35,代码来源:imageViewCode.cs

示例15: ViewDidLoad

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

            // set the background color of the view to white
            this.View.BackgroundColor = UIColor.White;

            this.Title = "Scroll View";

            // create our scroll view
            scrollView = new UIScrollView (
                new RectangleF (0, 0, View.Frame.Width
                , View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
            View.AddSubview (scrollView);

            // create our image view
            imageView = new UIImageView (UIImage.FromFile ("halloween.jpg"));
            scrollView.ContentSize = imageView.Image.Size;
            scrollView.AddSubview (imageView);

            // set allow zooming
            scrollView.MaximumZoomScale = 3f;
            scrollView.MinimumZoomScale = .1f;
            scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
        }
开发者ID:omxeliw,项目名称:recipes,代码行数:25,代码来源:ScrollViewController.cs


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