2

I have an iOS Application. When the user clicks on a textview, the cursor is very small initially. This is what it looks like:

enter image description here

As soon as the user begins typing, the cursor changes size and becomes much bigger. This is what it looks like:

enter image description here

As you can see, the cursor in the second image is bigger than the cursor in the first image. How do I make the initial cursor bigger? I want it to have the same size as the cursor that appears when the user starts typing.

Here is my code:

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UITextViewDelegate {

    @IBOutlet weak var userMessageTextView: UITextView!

    override func viewDidLoad() {
        super.viewDidLoad()

        self.userMessageTextView.delegate = self

        //Used to make the border of the TextView look the same as the border of a TextField
        userMessageTextView.layer.borderColor = UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0).cgColor
        userMessageTextView.layer.borderWidth = 1.0
        userMessageTextView.layer.cornerRadius = 5   
    }

    func textViewDidBeginEditing(_ textView: UITextView) {
        //Used to Make the Cursor appear somewhat centered in the TextView; Without this, the bottom of the cursor is lined up with the bottom edge of the TextView, so the cursor is not centered within the textView
        userMessageTextView.contentOffset.y = 4.0
    }
}
Everett
  • 387
  • 1
  • 4
  • 17

0 Answers0