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


C# UITextView.BecomeFirstResponder方法代码示例

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


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

示例1: UiSetKeyboardEditorWithCloseButton

        public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType)
        {
            var toolbar = new UIToolbar
            {
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            };
            txt.KeyboardType = keyboardType;
            toolbar.SizeToFit();

            var text = new UITextView(new CGRect(0, 0, 200, 32))
            {
                ContentInset = UIEdgeInsets.Zero,
                KeyboardType = keyboardType,
                Text = txt.Text,
                UserInteractionEnabled = true
            };
            text.Layer.CornerRadius = 4f;
            text.BecomeFirstResponder();

            var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                 (s, e) =>
                {
                    text.ResignFirstResponder();
                    txt.ResignFirstResponder();
                });

            toolbar.UserInteractionEnabled = true;
            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);

            txt.InputAccessoryView = toolbar;
        }
开发者ID:nodoid,项目名称:mvvmlight1,代码行数:32,代码来源:UIUtils.cs

示例2: NewMessageController

		public NewMessageController ()
		{
			Title = "New Post";

			NavigationItem.LeftBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Cancel,
				delegate {
					DismissModalViewControllerAnimated (true); 
				});

			NavigationItem.RightBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Save,
				delegate {
					DismissModalViewControllerAnimated (true);
					Saved (new Message {
						Id = Guid.NewGuid (),
						From = UIDevice.CurrentDevice.Name,
						Text = _text.Text,
						Time = DateTime.UtcNow,
					});
				});

			var b = View.Bounds;
			_text = new UITextView (new RectangleF (0, 0, b.Width, 200)) {
				Font = UIFont.SystemFontOfSize (20),
			};
			_text.BecomeFirstResponder ();
			View.AddSubview (_text);
		}
开发者ID:GSerjo,项目名称:Seminars,代码行数:29,代码来源:NewMessageController.cs

示例3: EditingStarted

        public override void EditingStarted(UITextView textView)
        {
            if (textView.Text == "Content") {
                textView.Text = "";
                textView.TextColor = UIColor.Black;
                textView.Font = FontConstants.SourceSansProRegular (13);
            }

            textView.BecomeFirstResponder ();
        }
开发者ID:pierceboggan,项目名称:Verses,代码行数:10,代码来源:ContentTextDelegate.cs

示例4: EditingStarted

 public override void EditingStarted(UITextView textView)
 {
     if (textView.Text == Placeholder)
     {
         textView.Text = "";
         textView.TextColor = UIColor.Black;
     }
     textView.BecomeFirstResponder();
     textView.BackgroundColor = UIColor.White;
     UIView view = getRootSuperView(textView);
     CoreGraphics.CGRect rect = view.Frame;
     rect.Y -= 80;
     view.Frame = rect;
 }
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:14,代码来源:CustomEditorRenderer.cs

示例5: EditingStarted

		public override void EditingStarted (UITextView textView)
		{
			if (textView.Text == "Add Comment") 
			{
				textView.Text = "";
				textView.TextColor = UIColor.Black;
			}

			textView.BecomeFirstResponder ();

			var parentScrollView = GetScrollView (textView);

			if (parentScrollView != null) 
			{
				var newOffset = new PointF (0, parentScrollView.ContentOffset.Y + 210);
				parentScrollView.SetContentOffset (newOffset, true);
			}
		}
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:18,代码来源:CommentTextBoxRenderer.cs

示例6: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "Import";
            View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;

            // Import textbox
            _textFieldImport = new UITextView();
            _textFieldImport.Frame = new RectangleF(10, 15, 300, 170);
            _textFieldImport.Layer.CornerRadius = 5;
            _textFieldImport.ClipsToBounds = true;
            _textFieldImport.BecomeFirstResponder();
            _textFieldImport.Text = "To import questions, use a comma separated format like so:" +
                "\n\n" +
                "category name,question,answer\n\n" +
                "The category name is not case sensitive. Use a tilde (~) if you need to use a comma.";
            View.AddSubview(_textFieldImport);

            // Help label
            _labelHelp = new UILabel();

            _labelHelp.Font = UIFont.SystemFontOfSize(14f);
            _labelHelp.TextColor = UIColor.DarkGray;
            _labelHelp.Frame = new RectangleF(15, 235, 295, 150);
            _labelHelp.BackgroundColor = UIColor.Clear;
            _labelHelp.Lines = 10;
            View.AddSubview(_labelHelp);

            // Import button
            _importButton = new UIBarButtonItem();
            _importButton.Title = "Import";
            _importButton.Clicked += ImportClick;

            // Hide the toolbar.
            NavigationController.SetToolbarHidden(true, true);
            NavigationItem.HidesBackButton = false;
            NavigationItem.SetRightBarButtonItem(_importButton, false);
        }
开发者ID:yetanotherchris,项目名称:flashback,代码行数:38,代码来源:ImportController.cs

示例7: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            titleLabel.Text = _settings.Messages.EnterPasswordTitle;

            ChangePinBoxBallColor(_settings.Appearence.PinBoxBallColor);
            View.BackgroundColor = _settings.Appearence.BackgroundColor;
            titleLabel.TextColor = _settings.Appearence.TitleColor;
            pinBox0.BackgroundColor = _settings.Appearence.PinBoxColor;
            pinBox1.BackgroundColor = _settings.Appearence.PinBoxColor;
            pinBox2.BackgroundColor = _settings.Appearence.PinBoxColor;
            pinBox3.BackgroundColor = _settings.Appearence.PinBoxColor;

            _fakeField = new UITextView(CGRect.Empty)
                             {
                                 KeyboardType = UIKeyboardType.NumberPad,
                                 SecureTextEntry = true
                             };

            if(IsIPhone)
            {
                _fakeField.BecomeFirstResponder();
            }
            else
            {
                InitializeIPadNumericButton(zero, 0);
                InitializeIPadNumericButton(one, 1);
                InitializeIPadNumericButton(two, 2);
                InitializeIPadNumericButton(three, 3);
                InitializeIPadNumericButton(four, 4);
                InitializeIPadNumericButton(five, 5);
                InitializeIPadNumericButton(six, 6);
                InitializeIPadNumericButton(seven, 7);
                InitializeIPadNumericButton(eight, 8);
                InitializeIPadNumericButton(nine, 9);
                InitializeIPadNumericButton(back, -1);
            }

            _fakeField.Changed += PasswordChanged;
            View.AddSubview(_fakeField);
        }
开发者ID:sebfia,项目名称:LockScreen,代码行数:42,代码来源:LockScreenController.cs

示例8: SetupUI

        private void SetupUI()
        {
            View.BackgroundColor = UIColor.White;

            verseReference = new UITextField {
                BackgroundColor = UIColor.Clear,
                BorderStyle = UITextBorderStyle.None,
                Enabled = false,
                Font = FontConstants.SourceSansProBold (17),
                Frame = new RectangleF (0, 0, View.Bounds.Size.Width, 28f),
                Text = verse.Title
            };

            blackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile (Images.BlackLine)),
                Frame = new RectangleF (0, 28, View.Bounds.Width, 3f)
            };

            verseComments = new UITextView {
                Font = FontConstants.SourceSansProRegular (15),
                Frame = new RectangleF (0, 31, View.Bounds.Width, 145f),
                KeyboardAppearance = UIKeyboardAppearance.Default,
                Text = verse.Comments,
                TextAlignment = UITextAlignment.Left
            };
            verseComments.BecomeFirstResponder ();

            View.AddSubview (verseReference);
            View.AddSubview (blackLine);
            View.AddSubview (verseComments);
        }
开发者ID:pierceboggan,项目名称:Verses,代码行数:31,代码来源:VerseEditDialog.cs


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