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


C# UITextField.SetInputViewEx方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:xRoulanDx,项目名称:MugenMvvmToolkit.Samples,代码行数:70,代码来源:LocalizableViewController.cs


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