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


C# UIView.ViewWithTag方法代码示例

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


在下文中一共展示了UIView.ViewWithTag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Draw

		public override void Draw (RectangleF bounds, CGContext context, UIView view)
		{
			//UIColor.White.SetFill ();
			//context.FillRect (bounds);
			try
			{
				UIView searchView = view.ViewWithTag(1);				
				if (searchView == null)
				{
					var photoCellView = new PhotoCellView(_images, cellIndex, null);										
					
					photoCellView.Tag = 1;
					view.Add(photoCellView);
				}
				else
				{
					var photoCellView = (PhotoCellView)searchView;					
					photoCellView.Update(_images, cellIndex);
					
					photoCellView.DrawBorder(UIColor.Green);
				}
			}
			catch (Exception ex)
			{
				Util.LogException("Draw ImagesElement", ex);
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:27,代码来源:ImagesElement.cs

示例3: ViewForItemAtIndex

 public override UIView ViewForItemAtIndex(iCarousel carousel, uint index, UIView view)
 {
     //create new view if no view is available for recycling
     if (view == null) {
         var v = new UIImageView (new RectangleF (0f, 0f, 200.0f, 200.0f));
         v.Image = UIImage.FromBundle ("page.png");
         v.ContentMode = UIViewContentMode.Center;
         var l = new UILabel (v.Bounds);
         l.BackgroundColor = UIColor.Clear;
         l.TextAlignment = UITextAlignment.Center;
         l.Font = l.Font.WithSize (50f);
         l.Tag = 1;
         l.Text = owner.items [(int)index].ToString ();
         v.AddSubview (l);
         return v;
     }
     var label = (UILabel)view.ViewWithTag (1);
     label.Text = owner.items [(int)index].ToString ();
     return view;
 }
开发者ID:nachocove,项目名称:iCarouselBinding,代码行数:20,代码来源:AdvancedDemoViewController.cs

示例4: PlaceholderViewAtIndex

            public override UIView PlaceholderViewAtIndex(iCarousel carousel, uint index, UIView view)
            {
                UILabel label = null;
                UIImageView imageView = null;

                //create new view if no view is available for recycling
                if (null == view) {
                    //don't do anything specific to the index within
                    //this `if (view == nil) {...}` statement because the view will be
                    //recycled and used with other index values later
                    imageView = new UIImageView (new RectangleF (0f, 0f, 200.0f, 200.0f));
                    imageView.Image = UIImage.FromBundle ("page.png");
                    imageView.ContentMode = UIViewContentMode.Center;
                    label = new UILabel (imageView.Bounds);
                    label.BackgroundColor = UIColor.Clear;
                    label.TextAlignment = UITextAlignment.Center;
                    label.Font = label.Font.WithSize (50f);
                    label.Tag = 1;
                    imageView.AddSubview (label);
                } else {
                    label = (UILabel)view.ViewWithTag (1);
                    imageView = (UIImageView)view;
                }
                //set item label
                //remember to always set any properties of your carousel item
                //views outside of the `if (view == nil) {...}` check otherwise
                //you'll get weird issues with carousel item content appearing
                //in the wrong place in the carousel
                label.Text = (index == 0) ? "[" : "]";

                return imageView;
            }
开发者ID:nachocove,项目名称:iCarouselBinding,代码行数:32,代码来源:AdvancedDemoViewController.cs

示例5: GetViewForItem

            public override UIView GetViewForItem(iCarousel carousel, nint index, UIView view)
            {
                UILabel label = null;
                UIImageView imageView = null;

                if (view == null) {
                    // create new view if no view is available for recycling
                    imageView = new UIImageView (new CGRect (0, 0, 200.0f, 200.0f));
                    imageView.Image = UIImage.FromBundle ("page.png");
                    imageView.ContentMode = UIViewContentMode.Center;

                    label = new UILabel (imageView.Bounds);
                    label.BackgroundColor = UIColor.Clear;
                    label.TextAlignment = UITextAlignment.Center;
                    label.Font = label.Font.WithSize (50);
                    label.Tag = 1;
                    imageView.AddSubview (label);
                } else {
                    // get a reference to the label in the recycled view
                    imageView = (UIImageView)view;
                    label = (UILabel)view.ViewWithTag (1);
                }

                // set the values of the view
                label.Text = items [index].ToString ();

                return imageView;
            }
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:28,代码来源:ExampleViewController.cs

示例6: ViewForItem

            public override UIView ViewForItem(iCarousel carousel, uint index, UIView reusingView)
            {
                UILabel label;

                // create new view if no view is available for recycling
                if (reusingView == null)
                {
                    // don't do anything specific to the index within
                    // this `if (view == null) {...}` statement because the view will be
                    // recycled and used with other index values later
                    var imgView = new UIImageView (new RectangleF (0, 0, 200, 200)) {
                        Image = UIImage.FromBundle ("page"),
                        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
                {
                    // get a reference to the label in the recycled view
                    label = (UILabel) reusingView.ViewWithTag (1);
                }

                // set item label
                // remember to always set any properties of your carousel item
                // views outside of the `if (view == null) {...}` check otherwise
                // you'll get weird issues with carousel item content appearing
                // in the wrong place in the carousel
                label.Text = vc.items[(int)index].ToString();

                return reusingView;
            }
开发者ID:amnextking,项目名称:monotouch-bindings,代码行数:39,代码来源:AutoScrollViewController.cs


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