การเปลี่ยนแบบอักษรและสีบน UITextView นั้นง่ายมาก คุณเพียงแค่ต้องอัปเดตคุณสมบัติ .textColor และ .font บนวัตถุ UITextView เราจะได้เห็นวิธีการทำในที่นี้
มาเริ่มกันเลย
เปิด Main.storyboard และเพิ่ม UITextView ดังที่แสดงด้านล่าง

Create @IBOutlet of UITextView and name it, textView. @IBOutlet var textView: UITextView!
ในเมธอด viewDidLoad ของ ViewController.swift ให้เขียนบรรทัดด้านล่าง
textView.textColor = UIColor.cyan textView.font = UIFont(name: "Callout", size: 20)
Final Code ควรมีลักษณะดังนี้
import UIKit
class ViewController: UIViewController {
@IBOutlet var textView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
textView.textColor = UIColor.cyan
textView.font = UIFont(name: "Callout", size: 20) เรียกใช้แอป
