Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8859113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:58:40+00:00 2026-06-14T14:58:40+00:00

I have a tableView that contains a few UITextView controls. When the user taps

  • 0

I have a tableView that contains a few UITextView controls. When the user taps on one of these the text inside should be selected so that any keyboard input immediately replaces the original content.

I cannot get the text inside a UITextView selected using this code:

txtQuantity.SelectAll (new NSObject(NSObjectFlag.Empty));

as this code only shows the menu “Select | Select All’ without the text being actually selected.

Has someone gotten this to work?

EDIT:
The code below select the text inside the txtQuantity control, BUT ONLY IF the UIAlert is show first! Why is this?

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

            txtQuantity.TouchDown += txtQuantityHandleTouchDown;

            txtQuantity.EditingDidBegin += delegate {

                txtQuantity.ExclusiveTouch=true;
                UIAlertView uv = new UIAlertView("","OK",null,"OK",null);
                uv.Show ();
            };

        }

        void txtQuantityHandleTouchDown (object sender, EventArgs e)
        {
            txtQuantity.SelectAll (this);
            txtQuantity.Selected = true;

        }

If all code within the txtQuality.EditingBegin delegate is commented out, the HandleTouchDown event does not fire.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:58:41+00:00Added an answer on June 14, 2026 at 2:58 pm

    I am not sure that this is what you are going for but I put together a quick sample.

    The problem I was having is with calling SelectAll in EditingDidBegin. I had to make a call to BeginInvokeOnMainThread to get the select to work. I am not sure if it is a problem with the event not happening on the main thread or you simply need to make an async call on the main thread.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    using MonoTouch.Foundation;
    using MonoTouch.UIKit;
    
    namespace SelectText
    {
        [Register ("AppDelegate")]
        public partial class AppDelegate : UIApplicationDelegate
        {
            // class-level declarations
            UIWindow window;
    
            public override bool FinishedLaunching (UIApplication app, NSDictionary options)
            {
                // create a new window instance based on the screen size
                window = new UIWindow (UIScreen.MainScreen.Bounds);
    
                window.RootViewController = new MyTableViewController ();
    
                // make the window visible
                window.MakeKeyAndVisible ();
    
                return true;
            }
        }
    
        public class MyTableViewController : UITableViewController
        {
            public override void LoadView ()
            {
                base.LoadView ();
                this.TableView.DataSource = new TableViewDataSource ();
            }
            private class TableViewDataSource : UITableViewDataSource
            {
                private class EditCell : UITableViewCell
                {
                    UITextField _field;
    
                    public EditCell () : base (UITableViewCellStyle.Default, "mycell")
                    {
                        _field = new UITextField (this.Bounds);
                        _field.AutoresizingMask = UIViewAutoresizing.All;
                        _field.BackgroundColor = UIColor.Clear;
                        _field.ShouldReturn = delegate {
                            _field.ResignFirstResponder ();
    
                            return true;
                        };
    
                        _field.EditingDidBegin += delegate {
                            this.BeginInvokeOnMainThread ( delegate {
                                _field.SelectAll (this);
                            });
                        };
    
                        _field.Text = "Some Text";
                        this.Add (_field);
                    }
    
                    public override void LayoutSubviews ()
                    {
                        base.LayoutSubviews ();
                        _field.Frame = this.Bounds;
                    }
    
    
                }
    
                #region implemented abstract members of UITableViewDataSource           
                public override int RowsInSection (UITableView tableView, int section)
                {
                    return 2;
                }           
    
                public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
                {
                    UITableViewCell cell = tableView.DequeueReusableCell ("mycell");
    
                    if (cell == null)
                    {
                        cell = new EditCell ();
                    }
    
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
    
                    return cell;
                }           
                #endregion
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tableview, one of the rows contains a cell that contains a
I have a tableview that contains cell images and names as text. At the
i have one tableview that have custom cells and one cell contains uiimageview,uilabels .
I have a controller that contains a tableView that spawns another controller modally to
I have a UITableViewController that contains a tableView. I want to set its scrollView
I have a simple iOS 5 storyboard that contains a tableview controller scene. However,
I have a tableview with a section that contains a list of sounds the
I have an application that contains 4 mutable arrays,i already displays one array of
I have a UITableView in a UINavigationController that contains a rightBarButtonItem which should hide
i have a tableView contains a couple af answers, the user will select an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.