
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to create scrollable TextView on iOS App?
To create a scrollable TextView in iOS we can do it in two ways, one by creating it using the storyboard and other by creating another textView programmatically.
A text view is scrollable by default if it has text more than the height of textView and the scrollable property is disabled.
1.Using storyboard
Go to storyboard and from the object library drag a textView to your view.
Now in the text view if the text is more than it’s height than it will be scrollable by default, otherwise it will not be scrollable.
Give height constraint along with remaining required constraint.
Make sure that scrolling enabled is selected and user interaction is enabled.
2.Programmatically
To programmatically create a text view you can use the following code. Make sure to give it constraints too.
lettx = UITextView() tx.isScrollEnabled = true tx.isUserInteractionEnabled = true tx.frame = CGRect(x: 10, y: 10, width: self.view.frame.width, height: 100) tx.text = "Loremipsum dolor sit erelitlamet, consectetaurcilliumadipisicingpecu, sed do eiusmodtemporincididuntutlabore et dolore magna aliqua. Utenim ad minim veniam, quisnostrud exercitation ullamcolaboris nisi utaliquip ex eacommodoconsequat.Duisauteirure dolor in reprehenderit in voluptatevelitessecillumdoloreeufugiatnullapariatur. Excepteursintoccaecatcupidatat non proident, sunt in culpa qui officiadeseruntmollitanim id estlaborum. Nam liber teconscient to factor tum poenlegumodioqueciviuda." self.view.addSubview(tx)
This will create a scrollable text view in your application which looks like:
- Related Questions & Answers
- How to create a scrollable textView Android app?
- How to create multiple styles inside a TextView on iOS App?
- How to create scrollable TextView on Android using Kotlin?
- How to create a Custom Dialog box on iOS App using Swift?
- How to create CollectionView Layout in an iOS App?
- How to create Tab Bar Layout in an iOS App?
- How to make an HTTP request on iOS App using Swift?
- How to create a WebView in an iOS App using Swift?
- How to load and display an image on iOS App using Swift?
- How to make an HTTP POST request on iOS App using Swift?
- How to create clickable links in a textView on Android?
- How to display an image with rounded corners on iOS App using Swift?
- How to handle right-to-left and left-to-right swipe gestures on iOS App?
- How to check notifications status for the iOS App
- How to create clickable links in a TextView on Android using Kotlin?