本文整理汇总了C#中UITextField.SetInputViewEx方法的典型用法代码示例。如果您正苦于以下问题:C# UITextField.SetInputViewEx方法的具体用法?C# UITextField.SetInputViewEx怎么用?C# UITextField.SetInputViewEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITextField
的用法示例。
在下文中一共展示了UITextField.SetInputViewEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.White;
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<LocalizableViewModel>())
{
UIFont font = UIFont.SystemFontOfSize(10);
var label = new UILabel(new CGRect(20, 0, View.Frame.Width - 40, 25))
{
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
TextColor = UIColor.Green,
Font = font
};
set.Bind(label).To(() => vm => BindingSyntaxEx.Resource(LocalizationManager.ResourceName, () => LocalizableResources.AddText));
scrollView.AddSubview(label);
label = new UILabel(new CGRect(20, 25, View.Frame.Width - 40, 25))
{
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
TextColor = UIColor.Green,
Font = font
};
set.Bind(label).To(() => vm => BindingSyntaxEx.Resource(LocalizationManager.ResourceName, () => LocalizableResources.EditText));
scrollView.AddSubview(label);
label = new UILabel(new CGRect(20, 50, View.Frame.Width - 40, 25))
{
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
TextColor = UIColor.Green,
Font = font
};
set.Bind(label).To(() => vm => BindingSyntaxEx.Resource(LocalizationManager.ResourceName, () => LocalizableResources.DeleteText));
scrollView.AddSubview(label);
var textField = new UITextField(new CGRect(20, 75, View.Frame.Width - 40, 30))
{
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
BorderStyle = UITextBorderStyle.RoundedRect,
ShouldChangeCharacters = (field, range, replacementString) => false
};
set.Bind(textField).To(() => model => model.SelectedCulture);
scrollView.AddSubview(textField);
var pickerView = new UIPickerView { ShowSelectionIndicator = true };
set.Bind(pickerView, AttachedMemberConstants.ItemsSource)
.To(() => model => model.Cultures);
set.Bind(pickerView, AttachedMemberConstants.SelectedItem)
.To(() => model => model.SelectedCulture)
.TwoWay();
var toolbar = new UIToolbar { BarStyle = UIBarStyle.Black, Translucent = true };
toolbar.SizeToFit();
var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
(s, e) => textField.ResignFirstResponder());
toolbar.SetItems(new[] { doneButton }, true);
textField.SetInputViewEx(pickerView);
textField.InputAccessoryView = toolbar;
}
}