https://github.com/amirdaliri/tagarrayview
https://github.com/amirdaliri/tagarrayview
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/amirdaliri/tagarrayview
- Owner: AmirDaliri
- License: mit
- Created: 2018-07-06T09:04:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-06T09:16:54.000Z (almost 7 years ago)
- Last Synced: 2025-02-13T14:41:26.686Z (3 months ago)
- Language: Swift
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TagListView
[](https://travis-ci.org/ElaWorkshop/TagListView)
[](http://cocoadocs.org/docsets/TagListView/)
[](https://github.com/ElaWorkshop/TagListView/blob/master/LICENSE)
[](https://github.com/Carthage/Carthage)Simple and highly customizable iOS tag list view, in Swift.
Supports Storyboard, Auto Layout, and @IBDesignable.
## Usage
The most convenient way is to use Storyboard. Drag a view to Storyboard and set Class to `TagListView` (if you use CocoaPods, also set Module to `TagListView`). Then you can play with the attributes in the right pane, and see the preview in real time thanks to [@IBDesignable](http://nshipster.com/ibinspectable-ibdesignable/).
You can add tag to the tag list view, or set custom font and alignment through code:
```swift
tagListView.textFont = UIFont.systemFontOfSize(24)
tagListView.alignment = .Center // possible values are .Left, .Center, and .RighttagListView.addTag("TagListView")
tagListView.addTags(["Add", "two", "tags"])tagListView.insertTag("This should be the second tag", at: 1)
tagListView.setTitle("New Title", at:6) // to replace the title a tag
tagListView.removeTag("meow") // all tags with title “meow” will be removed
tagListView.removeAllTags()
```You can implement `TagListViewDelegate` to receive tag pressed event:
```swift
// ...
{
// ...
tagListView.delegate = self
// ...
}func tagPressed(title: String, tagView: TagView, sender: TagListView) {
print("Tag pressed: \(title), \(sender)")
}
```You can also customize a particular tag, or set tap handler for it by manipulating the `TagView` object returned by `addTag(_:)`:
```swift
let tagView = tagListView.addTag("blue")
tagView.tagBackgroundColor = UIColor.blueColor()
tagView.onTap = { tagView in
print("Don’t tap me!")
}
```Be aware that if you update a property (e.g. `tagBackgroundColor`) for a `TagListView`, all the inner `TagView`s will be updated.
## Installation
drag **TagListView** folder into your project.
## Contribution
Pull requests are welcome! If you want to do something big, please open an issue to let me know first.
## License
MIT