Large Text Being Cut Off in UITextView That is Inside UIScrollView

This issue has existed since iOS 7 and is still present in iOS 12. However, I wasn’t able to keep the normal scrolling behaviour by setting scrollEnabled = NO before the resize, as @igz recommended. Instead I switched scrolling on and off after the resize // Resize text view here textView.scrollEnabled = NO; textView.scrollEnabled = … Read more

Add “padding” to a UITextView

Using Objective-C I have done it just with [self.textView setTextContainerInset:UIEdgeInsetsMake(0, 12, 0, 12)]; For Swift you can use: textview.contentInset = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 12) You can also create a Swift Extension (Suggested by chowdhury-md-rajib-sarwar) here: extension UITextView { func leftSpace() { self.textContainerInset = UIEdgeInsets(top: 4, left: 6, bottom: 4, right: 4) … Read more

How do I size a UITextView to its content on iOS 7?

I favor this minimal code change: Just add these two lines after addSubview and before grabbing the height of the frame … [scrollView1 addSubview: myTextView]; [myTextView sizeToFit]; //added [myTextView layoutIfNeeded]; //added CGRect frame = myTextView.frame; … This is tested backwards compatible with iOS 6. NOTE that it shrink-wraps the width. If you’re just interested in … Read more

UITextView: Disable selection, allow links

I find the concept of fiddling with the internal gesture recognizers a little scary, so tried to find another solution. I’ve discovered that we can override point(inside:with:) to effectively allow a “tap-through” when the user isn’t touching down on text with a link inside it: // Inside a UITextView subclass: override func point(inside point: CGPoint, … Read more

dismiss keyboard with a uiTextView

This works for me: import UIKit class ViewController: UIViewController, UITextViewDelegate { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() textView.delegate = self } /* Updated for Swift 4 */ func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if(text == “\n”) { textView.resignFirstResponder() return false } return true } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)