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


C# UIView类代码示例

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


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

示例1: ViewForItem

		public override UIView ViewForItem(CarouselView carousel, uint index, UIView reusingView)
		{

			UILabel label;

			if (reusingView == null)
			{
				var imgView = new UIImageView(new RectangleF(0, 0, 200, 200))
				{

					Image = FromUrl( index > 1 ? product[0].ImageForSize(250) : product[(int)index].ImageForSize(250) ),
					ContentMode = UIViewContentMode.Center
				};


				label = new UILabel(imgView.Bounds)
				{
					BackgroundColor = UIColor.Clear,
					TextAlignment = UITextAlignment.Center,
					Tag = 1
				};
				label.Font = label.Font.WithSize(50);
				imgView.AddSubview(label);
				reusingView = imgView;
			}
			else
			{
				label = (UILabel)reusingView.ViewWithTag(1);
			}
				

			return reusingView;
		}
开发者ID:jonburn,项目名称:xamarin-store-app,代码行数:33,代码来源:ProductListViewController.cs

示例2: ViewDidLoad

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

            var label = new UILabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var button = new UIButton(UIButtonType.RoundedRect);
            button.SetTitle("Click Me", UIControlState.Normal);
            button.Frame = new RectangleF(10, 90, 300, 40);
            Add(button);
            var button2 = new UIButton(UIButtonType.RoundedRect);
            button2.SetTitle("Go Second", UIControlState.Normal);
            button2.Frame = new RectangleF(10, 130, 300, 40);
            Add(button2);

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).To(vm => vm.Hello);
            set.Bind(textField).To(vm => vm.Hello);
            set.Bind(button).To(vm => vm.MyCommand);
            set.Bind(button2).To(vm => vm.GoSecondCommand);
            set.Apply();
        }
开发者ID:janvdp,项目名称:NPlus1DaysOfMvvmCross,代码行数:25,代码来源:FirstView.cs

示例3: getRootSuperView

 private UIView getRootSuperView(UIView view)
 {
     if (view.Superview == null)
         return view;
     else
         return getRootSuperView(view.Superview);
 }
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:7,代码来源:CustomEditorRenderer.cs

示例4: FinishedLaunching

		public override bool FinishedLaunching(UIApplication app, NSDictionary options)
		{
			window = new UIWindow(UIScreen.MainScreen.Bounds);

			var controller = new UIViewController();
			var view = new UIView (UIScreen.MainScreen.Bounds);
			view.BackgroundColor = UIColor.White;
			controller.View = view;

			controller.NavigationItem.Title = "SignalR Client";

			var textView = new UITextView(new CGRect(0, 0, 320, view.Frame.Height - 0));
			view.AddSubview (textView);


			navController = new UINavigationController (controller);

			window.RootViewController = navController;
			window.MakeKeyAndVisible();

			if (SIGNALR_DEMO_SERVER == "http://YOUR-SERVER-INSTANCE-HERE") {
				textView.Text = "You need to configure the app to point to your own SignalR Demo service.  Please see the Getting Started Guide for more information!";
				return true;
			}
			
			var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);

			var client = new CommonClient(traceWriter);
			client.RunAsync(SIGNALR_DEMO_SERVER);

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

示例5: ViewDidLoad

		public override void ViewDidLoad ()
		{
            loadingBg = new UIView (this.View.Frame) { 
                BackgroundColor = UIColor.Black, 
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight 
            };
            loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge) {
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };
			loadingView.Frame = new CGRect ((this.View.Frame.Width - loadingView.Frame.Width) / 2, 
				(this.View.Frame.Height - loadingView.Frame.Height) / 2,
				loadingView.Frame.Width, 
				loadingView.Frame.Height);
			
			loadingBg.AddSubview (loadingView);
			View.AddSubview (loadingBg);
			loadingView.StartAnimating ();

			scannerView = new AVCaptureScannerView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height));
			scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay;
			scannerView.CustomOverlayView = this.Scanner.CustomOverlay;
			scannerView.TopText = this.Scanner.TopText;
			scannerView.BottomText = this.Scanner.BottomText;
			scannerView.CancelButtonText = this.Scanner.CancelButtonText;
			scannerView.FlashButtonText = this.Scanner.FlashButtonText;
            scannerView.OnCancelButtonPressed += () => {
                Scanner.Cancel ();
            };

			this.View.AddSubview(scannerView);
			this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
		}
开发者ID:rpmendes2017,项目名称:ZXing.Net.Mobile,代码行数:33,代码来源:AVCaptureScannerViewController.cs

示例6: ViewDidLoad

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

            var view = new UIView
            {
                BackgroundColor = UIColor.White
            };

            var label = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "No Conversation Selected",
                TextColor = UIColor.FromWhiteAlpha(0.0f, 0.4f),
                Font = UIFont.PreferredHeadline
            };
            view.AddSubview(label);

            view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal,
                    view, NSLayoutAttribute.CenterX, 1.0f, 0.0f));
            view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal,
                    view, NSLayoutAttribute.CenterY, 1.0f, 0.0f));

            View = view;
        }
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:25,代码来源:AAPLEmptyViewController.cs

示例7: ViewDidLoad

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

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var textField = new UITextField(new RectangleF(10, 10, 300, 40));
            Add(textField);

            var tableView = new UITableView(new RectangleF(0, 50, 320, 500), UITableViewStyle.Plain);
            Add(tableView);

			// choice here:
			//
			//   for original demo use:
            //     var source = new MvxStandardTableViewSource(tableView, "TitleText");
			//
			//   or for prettier cells from XIB file use:
			//     tableView.RowHeight = 88;
			//     var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);

			tableView.RowHeight = 88;
			var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);
			tableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textField).To(vm => vm.SearchTerm);
            set.Bind(source).To(vm => vm.Results);
            set.Apply();

            tableView.ReloadData();
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:35,代码来源:FirstView.cs

示例8: UIViewElement

 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="caption">
 /// The caption, only used for RootElements that might want to summarize results
 /// </param>
 /// <param name="view">
 /// The view to display
 /// </param>
 /// <param name="transparent">
 /// If this is set, then the view is responsible for painting the entire area,
 /// otherwise the default cell paint code will be used.
 /// </param>
 public UIViewElement(string caption, UIView view, bool transparent)
     : base(caption)
 {
     this.View = view;
     this.Flags = transparent ? CellFlags.Transparent : 0;
     key = new NSString("UIViewElement" + _count++);
 }
开发者ID:acejack987,项目名称:CivicaGlossaryIOSApp,代码行数:20,代码来源:UIViewElement.cs

示例9: TabControlItem

        public TabControlItem(CGRect frame, string title)
        {
            this.Frame = frame;
            var parentFrame = frame;
            var labelFont = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? UIFont.BoldSystemFontOfSize(15) : UIFont.BoldSystemFontOfSize(10);

            this.labelTitle = new UILabel(new CGRect(0, 0, parentFrame.Width / 2, parentFrame.Height))
            {
                Text = title,
                TextAlignment = UITextAlignment.Center,
                AdjustsFontSizeToFitWidth = true,
                LineBreakMode = UILineBreakMode.TailTruncation,
                Lines = 2,
                Font = labelFont
            };

            this.button = new UIButton(new CGRect(0, 0, parentFrame.Width, parentFrame.Height));
            this.viewColor = new UIView(new CGRect(0, parentFrame.Height - 1, parentFrame.Width, 1));

            this.Add(this.labelTitle);
            this.Add(this.button);
            this.Add(this.viewColor);

            this.button.TouchUpInside += (s, e) =>
            {
                if (tabEnabled)
                {
                    SelectTab();
                }
            };
        }
开发者ID:Immons,项目名称:XamarinHelper,代码行数:31,代码来源:TabControlItem.cs

示例10: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            normalButton = GetButton (new CGRect (10, 120, 295, 48),
                                      FoodyTheme.SharedTheme.ButtonImage,
                                      "Standard Button");
            View.AddSubview (normalButton);

            pressedButton = GetButton (new CGRect (10, 190, 295, 48),
                                       FoodyTheme.SharedTheme.PressedButtonImage,
                                       "Button Pressed");
            View.AddSubview (pressedButton);

            label = new UILabel (new CGRect (15, 40, 400, 30));
            FoodyTheme.Apply (label);
            label.Text = "Label";
            View.AddSubview (label);

            var paddingView = new UIView (new CGRect (0, 0, 5, 20));
            TextField.LeftView = paddingView;
            TextField.LeftViewMode = UITextFieldViewMode.Always;
            TextField.ShouldReturn = TextFieldShouldReturn;
            TextField.Background = FoodyTheme.SharedTheme.TextFieldBackground;

            progress = new UIProgressView (new CGRect (13, 300, 292, 10));
            progress.Progress = 0.5f;
            View.AddSubview (progress);

            slider = new UISlider (new CGRect (10, 330, 298, 10));
            slider.Value = 0.5f;
            slider.ValueChanged += HandleValueChanged;
            View.AddSubview (slider);

            FoodyTheme.Apply (View);
        }
开发者ID:alleeclark,项目名称:morganHack,代码行数:35,代码来源:ElementThemeController.cs

示例11: ViewDidLoad

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

            View = new UIView() { BackgroundColor = UIColor.White };

            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            TableView = new UITableView(UIScreen.MainScreen.Bounds);
            var source = new MvxStandardTableViewSource(
                TableView,
                UITableViewCellStyle.Subtitle,
                CellIdentifier,
                "TitleText Title; DetailText Start"
            );

            TableView.Source = source;

            var set = this.CreateBindingSet<ConferenceView, ConferenceViewModel>();
            set.Bind(source).To(vm => vm.Sessions);
            set.Apply();

            TableView.ReloadData();
        }
开发者ID:RobGibbens,项目名称:CodeStock,代码行数:25,代码来源:ConferenceView.cs

示例12: LoadView

        //Recipe 2-1 Adding Nested Subviews
        public override void LoadView()
        {
            //Create the main view
            RectangleF appRect = UIScreen.MainScreen.ApplicationFrame;

            contentView = new UIView(appRect);
            contentView.BackgroundColor = UIColor.Green;

            //Provide support for autorotation and resizing
            contentView.AutosizesSubviews = true;
            contentView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View = contentView;

            // reset the origin point for subviews. The new origin is 0, 0
            appRect.Location = new PointF(0.0f, 0.0f);

            //Add the subviews, each stepped by 32 pixels on each side
            var subview = new UIView(RectangleF.Inflate(appRect, -32.0f, -32.0f));
            subview.BackgroundColor = UIColor.Clear;
            contentView.AddSubview(subview);

            subview = new UIView(RectangleF.Inflate(appRect, -64.0f, -64.0f));
            subview.BackgroundColor = UIColor.DarkGray;
            contentView.AddSubview(subview);

            subview = new UIView(RectangleF.Inflate(appRect, -96.0f, -96.0f));
            subview.BackgroundColor = UIColor.Black;
            contentView.AddSubview(subview);
        }
开发者ID:lobrien,项目名称:iPhone-Developer-s-Cookbook-in-Monotouch,代码行数:30,代码来源:MyViewController.cs

示例13: AwakeFromNib

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

            if (!Theme.IsiOS7) {
                BackgroundView = new UIImageView { Image = Theme.Inlay };
                photoFrame.Image = Theme.PhotoFrame;
                return;
            }

            SelectionStyle = UITableViewCellSelectionStyle.Blue;
            SelectedBackgroundView = new UIView { BackgroundColor = UIColor.Clear };
            BackgroundView = new UIView { BackgroundColor = Theme.BackgroundColor };

            date.TextColor =
                description.TextColor = Theme.LabelColor;
            date.Font = Theme.FontOfSize (18);
            description.Font = Theme.FontOfSize (14);

            //Change the image frame
            var frame = photoFrame.Frame;
            frame.Y = 0;
            frame.Height = Frame.Height;
            frame.Width -= 12;
            photo.Frame = frame;

            //Changes to widths on text
            frame = date.Frame;
            frame.Width -= 15;
            date.Frame = frame;

            frame = description.Frame;
            frame.Width -= 15;
            description.Frame = frame;
        }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:35,代码来源:PhotoCell.cs

示例14: Container

        //
        public Container()
        {
            ClipsToBounds = true;
              _state = State.Collapsed;

              Layer.BackgroundColor = UIColor.White.CGColor;
              Layer.BorderColor = UIColor.LightGray.CGColor;
              Layer.BorderWidth = 1;

              Header = this.Add<Header>();
              _content = this.Add<UIView>();
              _content.ClipsToBounds = true;

              Header.BackgroundColor = UIColor.White;
              Header.Layer.BorderColor = UIColor.LightGray.CGColor;
              Header.Layer.BorderWidth = 1;

              Header
            .Anchor(NSLayoutAttribute.Top, this, NSLayoutAttribute.Top)
            .Anchor(NSLayoutAttribute.Left, this, NSLayoutAttribute.Left)
            .Anchor(NSLayoutAttribute.Right, this, NSLayoutAttribute.Right);

              _content
            .Anchor(NSLayoutAttribute.Top, Header, NSLayoutAttribute.Bottom)
            .Anchor(NSLayoutAttribute.Left, this, NSLayoutAttribute.Left)
            .Anchor(NSLayoutAttribute.Right, this, NSLayoutAttribute.Right)
            .Anchor(NSLayoutAttribute.Bottom, this, NSLayoutAttribute.Bottom);
        }
开发者ID:sebbarg,项目名称:yagnix,代码行数:29,代码来源:Container.cs

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


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