SJTwitterTagInputTextView
SJTwitterTagInputTextView copied to clipboard
SJTwitterTagInputTextView is a subclass of UIView, written in Swift, that enables the UIView to use as the "#" and "@" tag input view with suggestion list.
SJTwitterTagInputTextView
[](https://travis-ci.org/Sumit Jagdev/SJTwitterTagInputTextView)
Overview
SJTwitterTagInputTextView is a subclass of UIView, written in Swift, that enables the UIView to use as the "#" and "@" tag input view with suggestion list.
Requirements
- ARC
- iOS8
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
SJTwitterTagInputTextView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SJTwitterTagInputTextView"
Usage
import SJTwitterTagInputTextView
@IBOutlet var tagInputView : SJTwitterTagInputTextView!
tagInputView.delegate = self
//TODO : Please add height constraint and set id of constraint = "SJTextViewHeight"
//MARK : SJTwitterTagInputTextViewDelegate
func didSearchWithAtTag(tagString: String) {
// print("Current Search Word @ : ", tagString)
let predicate = NSPredicate(format: "SELF contains[cd] %@", tagString)
let array = allObjectList as NSArray!
let newArray = array.filteredArrayUsingPredicate(predicate)
tagInputView.allObjectList = newArray as! [String]
}
func didSearchWithHashTag(tagString: String) {
// print("Current Search Word # : ", tagString)
let predicate = NSPredicate(format: "SELF contains[cd] %@", tagString)
let array = allObjectList as NSArray!
let newArray = array.filteredArrayUsingPredicate(predicate)
tagInputView.allObjectList = newArray as! [String]
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("All @ Tags : ", tagInputView.getAllAtTags())
print("All # Tags : ", tagInputView.getAllHashTags())
}
Author
Sumit Jagdev, [email protected]
License
SJTwitterTagInputTextView is available under the MIT license. See the LICENSE file for more info.