
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Change Font and Color on UITextView in iOS
Changing font and color on UITextView is simple, you just need to update the .textColor and .font property on UITextView object, Here we will be seeing how to do so.
So let’s get started,
Open Main.storyboard and add UITextView as shown below,
Create @IBOutlet of UITextView and name it, textView. @IBOutlet var textView: UITextView!
In your viewDidLoad method of ViewController.swift write below lines,
textView.textColor = UIColor.cyan textView.font = UIFont(name: "Callout", size: 20)
Final Code should look like,
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)
Run the app,
Advertisements