Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
b5faaef4
Commit
b5faaef4
authored
Aug 06, 2018
by
Orkhan Alikhanov
Committed by
OrkhanAlikhanov
Aug 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to disable operations on textview's placeholderLabel
parent
f47aaf8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
Sources/iOS/TextView.swift
+15
-0
No files found.
Sources/iOS/TextView.swift
View file @
b5faaef4
...
...
@@ -134,6 +134,9 @@ open class TextView: UITextView {
@IBInspectable
public
let
placeholderLabel
=
UILabel
()
/// A property to enable/disable operations on the placeholderLabel
internal
var
isPlaceholderLabelEnabled
:
Bool
=
true
/// Placeholder normal text
@IBInspectable
open
var
placeholderColor
=
Color
.
darkText
.
others
{
...
...
@@ -325,12 +328,20 @@ fileprivate extension TextView {
fileprivate
extension
TextView
{
/// Updates the placeholderLabel text color.
func
updatePlaceholderLabelColor
()
{
guard
isPlaceholderLabelEnabled
else
{
return
}
tintColor
=
placeholderColor
placeholderLabel
.
textColor
=
placeholderColor
}
/// Updates the placeholderLabel visibility.
func
updatePlaceholderVisibility
()
{
guard
isPlaceholderLabelEnabled
else
{
return
}
placeholderLabel
.
isHidden
=
!
isEmpty
}
}
...
...
@@ -338,6 +349,10 @@ fileprivate extension TextView {
fileprivate
extension
TextView
{
/// Laysout the placeholder UILabel.
func
layoutPlaceholderLabel
()
{
guard
isPlaceholderLabelEnabled
else
{
return
}
placeholderLabel
.
preferredMaxLayoutWidth
=
textContainer
.
size
.
width
-
textContainer
.
lineFragmentPadding
*
2
let
x
=
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment