Skip to content

Commit

Permalink
Fixed an issue with IQTextView in swift. Fixed hackiftekhar#468.
Browse files Browse the repository at this point in the history
hackiftekhar committed Apr 4, 2016
1 parent 88c4e8f commit 95df953
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion IQKeyboardManagerSwift/IQTextView/IQTextView.swift
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ public class IQTextView : UITextView {

if placeholderLabel == nil {

placeholderLabel = UILabel(frame: CGRectInset(self.bounds, 5, 0))
placeholderLabel = UILabel()

if let unwrappedPlaceholderLabel = placeholderLabel {

@@ -79,6 +79,15 @@ public class IQTextView : UITextView {
}
}

public override func layoutSubviews() {
super.layoutSubviews()

if let unwrappedPlaceholderLabel = placeholderLabel {
unwrappedPlaceholderLabel.sizeToFit()
unwrappedPlaceholderLabel.frame = CGRectMake(8, 8, CGRectGetWidth(self.frame)-16, CGRectGetHeight(unwrappedPlaceholderLabel.frame))
}
}

public func refreshPlaceholder() {

if text.characters.count != 0 {
2 changes: 1 addition & 1 deletion IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Cocoa
import UIKit

class IQPreviousNextView: UIView {

0 comments on commit 95df953

Please sign in to comment.