KWFillBlankViewController
A view controller can fill blank in text view.
Components
####KWFillBlankViewController
- Remember to press for a while when you click blanks with Xcode Simulator.
- The default blank is "_".
- Using by code beneath.
let text = "your _____ text _____ here "
let blankViewController = KWFillBlankViewController(contentText: text)
self.navigationController?.pushViewController(blankViewController, animated: true)
- If you want to do something when clicking the blank ,just using code beneath ,
blankViewController.delegate = self
- And complete this delegate
func fillBlankView(fillBlankView: UIView, didSelectedBlankRange range: NSRange)
- If you want to get the text you select ,just
blankViewController.textView.selectedText()
- If you want to get the array of texts of the blanks you fill
- The text of the blank you have not fill is ""
- You can use this function .
let arr:[String] = blankViewController.textView.contentTexts()
####KWFillBlankTextView
- KWFillBlankTextView is a subclass of UITextView
- It can be used independently
- You can set blank tag in the storyboard
- If you want to do something when clicking the blank ,just follow the UITextViewDelegate and using code beneath
func textView(textView: UITextView, shouldInteractWithURL URL: NSURL, inRange characterRange: NSRange) -> Bool {
if URL.absoluteString == "blank"{
//type your code here
return false
}
return true
}
Installation
- Install with CocoaPods
pod 'KWFillBlankViewController'
- Copy the KWFillBlankViewController folder to your project
License
KWFillBlankViewController is released under the MIT license. See LICENSE for details.