transparent UITextView
How do I make a UITextView transparent? I built th开发者_StackOverflow社区e view in Interface Builder and placed a UITextView into it and it covers the background.
Any ideas?
Change background color, and use opacity slider to make it fully transparent.
Programmatically:
textView.backgroundColor = [UIColor clearColor];
Up to iOS 4.3 You had to do the Interface Builder version of setting the background opacity. But as of iOS 5, you can set the backgroundColor and it will work. Just keep in mind when making apps for older OS versions.
In Xcode 4 use interface builder and choose Background as Default
Swift 4.2
txtView.backgroundColor = .clear
If you are in the Interface Builder: Press cmd+1 to get to the Attributes Instructor pane
Scroll down to the section "View" And click at Background the two Arrows - there u can choose now between several kinds of colorization. In this case "Clear Color"
for Swift 4
textView.backgroundColor = UIColor.clear
For those who are looking for the simple answer please see the screenshot. Select TextView, change the Background property in the Attributes Inspector to "Clear Color"
精彩评论