How to edit UITextView by enabling AllowsEditingTextAttributes (create a Text Editor) in your iOS App to make selected text bold, italics, underline? – Xcode

In this video it shows simple steps to enable to enable or activate the allowsEditingTextAttributes in the uiTextView. This concept can be used to make the text editing possible in your iOS App. It uses a button to explicitly enable this option in the uiTextView’s attribute. This attribute (allowsEditingTextAttributes ) is also available in the layout editor in the form of a checkbox. However, that will enable the editing of the uiTextView only for the initial text and will not enable the editing for further texts entered while the App is running.

I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com

Complete Source Code:

//
// ViewController.swift
// Text Editor App
//
// Created by HomePC on 12/10/20.
// Copyright © 2020 HomePC. All rights reserved.
//
import UIKit
class ViewController: UIViewController {

@IBOutlet weak var uiTextView: UITextView!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func buttonEnableEditing(Sender: UIButton){
uiTextView.allowsEditingTextAttributes = true
}

}

Leave a Reply

%d bloggers like this: