本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}