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


C# UIPickerView.RowSizeForComponent方法代码示例

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


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

示例1: GetView

        public override UIView GetView( UIPickerView pickerView, nint row, nint component, UIView view )
        {
            nfloat width = pickerView.RowSizeForComponent(component).Width;
            nfloat height = pickerView.RowSizeForComponent(component).Height;

            var pickerCustomView = new UIView {
                Frame = new CGRect(0, 0, width - 10, height)
            };
            var pickerImageView = new UIImageView {
                Frame = new CGRect(20, height/4, height/2, height/2)
            };
            var pickerViewLabel = new UILabel {
                Frame = new CGRect(20 + height, 0, width - 10, height)
            };

            pickerCustomView.AddSubview(pickerImageView);
            pickerCustomView.AddSubview(pickerViewLabel);

            Category category = CategoryHelper.AllCategories[(int) row];

            pickerImageView.Image = new UIImage(category.IconSource);
            pickerViewLabel.BackgroundColor = UIColor.Clear;
            pickerViewLabel.Text = category.Name;
            pickerViewLabel.TextColor = category.Color.ToUIColor();

            return pickerCustomView;
        }
开发者ID:strongloop,项目名称:loopback-example-xamarin,代码行数:27,代码来源:CategoryPickerDelegate.cs

示例2: GetView

			/// <summary>
			/// Custom row view.
			///
			/// The <c>view</c> param is the reusable view for the row. It will be null initially.
			///
			/// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
			/// than every time this method is called.
			///
			/// Note that GetTitle() is no longer overridden since we aren't using the default row view
			/// </summary>
			public override UIView GetView (UIPickerView picker, nint row, nint component, UIView view)
			{
				//Lazy initialize
				if (view == null) {
					CGSize rowSize = picker.RowSizeForComponent (component);
					view = new UIView (new CGRect (new CGPoint (0, 0), rowSize));
				}
				//Modify state to reflect data
				view.BackgroundColor = Items [(int)row];
				return view;
			}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:21,代码来源:PickerView_CustomAppearance.cs

示例3: GetView

			public override UIView GetView (UIPickerView picker, int row, int component, UIView view)
			{
				var size = picker.RowSizeForComponent (component);
				
				if (component == 0 || component == 1){
					if (view == null || view.Tag != kColorTag){
						view = new UIView (new RectangleF (0, 0, size.Width-4, size.Height-4)){
							Tag = kColorTag
						};
					}
					view.BackgroundColor = Colors [row];
				} else {
					if (view == null || view.Tag != kLabelTag){
						view = new UILabel (new RectangleF (0, 0, size.Width-4, size.Height-4)){
							Tag = kLabelTag,
							Opaque = false,
							BackgroundColor = UIColor.Clear
						};
					}
					var label = (UILabel) view;
					label.TextColor = UIColor.Black;
					label.Text = BlendModes [row];
					label.Font = UIFont.BoldSystemFontOfSize (18f);
				}
				return view;
			}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:26,代码来源:QuartzBlendingViewController.xib.cs

示例4: GetView

 /// <summary>
 /// Custom row view. 
 /// 
 /// The <c>view</c> param is the reusable view for the row. It will be null initially.
 /// 
 /// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
 /// than every time this method is called. 
 /// 
 /// Note that GetTitle() is no longer overridden since we aren't using the default row view
 /// </summary>
 public override UIView GetView(UIPickerView picker, int row, int component, UIView view)
 {
     //Lazy initialize
     if(view == null)
     {
         SizeF rowSize = picker.RowSizeForComponent(component);
         view = new UIView(new RectangleF(new PointF(0,0), rowSize));
     }
     //Modify state to reflect data
     view.BackgroundColor = items[row];
     return view;
 }
开发者ID:Adameg,项目名称:mobile-samples,代码行数:22,代码来源:PickerView_CustomAppearance.cs


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