mirror of
https://github.com/zhigang1992/ParkedTextField.git
synced 2026-04-24 04:15:28 +08:00
Fix crash of setting super.placeholder
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "ParkedTextField"
|
||||
s.version = "0.1.0"
|
||||
s.version = "0.1.1"
|
||||
s.summary = "A UITextField subclass with an appended constant text"
|
||||
s.homepage = "https://github.com/gmertk/ParkedTextField"
|
||||
s.screenshots = "https://dl.dropboxusercontent.com/u/4397140/pod-screenshots/ParkedTextField.gif"
|
||||
|
||||
@@ -86,8 +86,10 @@ public class ParkedTextField: UITextField {
|
||||
if let placeholder = placeholder {
|
||||
let attributedString = NSMutableAttributedString(string: placeholder)
|
||||
let parkedTextRange = NSMakeRange(count(placeholderText), count(parkedText))
|
||||
attributedString.addAttributes(parkedTextAttributes, range: parkedTextRange)
|
||||
attributedPlaceholder = attributedString
|
||||
if placeholder.hasSuffix(parkedText) {
|
||||
attributedString.addAttributes(parkedTextAttributes, range: parkedTextRange)
|
||||
attributedPlaceholder = attributedString
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user