Skip to content

Commit

Permalink
Merge pull request #7 from lingochamp/contentView
Browse files Browse the repository at this point in the history
Expose the underlying UITextView as contentView, deprecate text view customization properties
  • Loading branch information
eyeplum authored Dec 30, 2016
2 parents f892636 + 1f3df3a commit c8387c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion demo/demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ class ViewController: UIViewController
override func viewDidLoad()
{
super.viewDidLoad()

textView.furiganas = exampleFuriganas
textView.contents = exampleContents

// after the contents has been set, the `contentView` will be referencing the underlying UITextView
// we can customize the UITextView the way we want
textView.contentView?.isScrollEnabled = false
textView.contentView?.backgroundColor = UIColor(white: 0.9, alpha: 1)
}

}
Expand Down
13 changes: 11 additions & 2 deletions src/FuriganaTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ open class FuriganaTextView: UIView

// MARK: - Public

open var scrollEnabled: Bool = true
open var alignment: NSTextAlignment = .left
public var contentView: UITextView? {
return underlyingTextView
}

open var furiganaEnabled = true
open var furiganaTextStyle = FuriganaTextStyle(hostingLineHeightMultiple: 1.6, textOffsetMultiple: 0)
Expand Down Expand Up @@ -144,6 +145,14 @@ open class FuriganaTextView: UIView
return vertical + horizontal
}

// MARK: - Deprecated

@available(*, deprecated)
open var scrollEnabled: Bool = true

@available(*, deprecated)
open var alignment: NSTextAlignment = .left

}

// MARK: - Furigana Handling
Expand Down

0 comments on commit c8387c5

Please sign in to comment.