Giter Club home page Giter Club logo

cloudtagview's Introduction

CloudTagView

Version License Platform Swift 4.0 compatible

This Pod helps you to create a simple cloud of tags based on Strings. You can manipulate the text, the padding and you can use the tintColor to modify the tag color. There are two delegates to handle taps in the tag: close icon and tag touch. You can access the example project for more details or contacting me.

Requirements

It requires Xcode 9.0+ and Swift 4.0.

Your project deployment target must be iOS 8.0+

For Swift 2.x support, use version 1.1.0 For Swift 3.x support, use version 2.0.0

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CloudTagView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CloudTagView'

Usage

Basic Usage

Just import CloudTagView and create a instance of CloudTagView. Works with Storyboard too

And append instancies of TagView inside the cloud.

import CloudTagView

class ViewController: UIViewController {

    let cloudView = CloudTagView()

    override func viewDidLoad() {
        super.viewDidLoad()

        cloudView.frame = CGRect(x: 0, y: 20, width: view.frame.width, height: 10)
        view.addSubview(cloudView)

        setupTags()
    }

    fileprivate func setupTags() {
        let tags = ["This", "is", "a", "example", "of", "Cloud", "Tag", "View"]

        for tag in tags {
            cloudView.tags.append(TagView(text: tag))
        }
    }
}

Other tags

Normal
let normalTag = TagView(text: "normal tag")
Fat
let fatTag = TagView(text: "fat tag")
fatTag.marginTop = 20
Long
let longTag = TagView(text: "stretched tag")
longTag.marginLeft = 40
Trimmed
let trimmedTag = TagView(text: "Trimmed: This tag is a example of tag with a huge text.")
trimmedTag.maxLength = 15
Without Icon
let withoutIconTag = TagView(text: "tag without dismiss icon")
withoutIconTag.iconImage = nil
Custom Font
let customFontTag = TagView(text: "different font tag")
customFontTag.font = UIFont(name: "Baskerville", size: 12)!
Custom Background Color
let coloredTag = TagView(text: "colored tag")
coloredTag.backgroundColor = UIColor.blue.withAlphaComponent(0.6)
Custom Tint Color
let tintColorTag = TagView(text: "tint color tag")
tintColorTag.tintColor = UIColor.yellow

TagViewDelegate

Dismiss Event
func tagDismissed(_ tag: TagView)
Touch Event
func tagTouched(_ tag: TagView)

Author

Henrique Morbin, [email protected]

License

CloudTagView is available under the MIT license. See the LICENSE file for more info.

cloudtagview's People

Contributors

calissendorff avatar clineu avatar morbix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cloudtagview's Issues

Animation?

Is it possible to add animation somehow? I'm only interested in animation when removing tags with the 'x', but adding animation would be useful too.

Sort of like what is possible with UIStackView

tzstackview-hide-animation

If the sliding is impossible, then I guess just fading would be good.

Change background color

Hi,
i would like to change the background color, to have different color in my tags, how can i do ?

Can't add image

I tried to add image tag:

let tag = TagView(text: s)
tag.iconImage = UIImage(named: "test")
cloudView.tags.append(tag)

but it just shows me a white blank view. Please, help me check!

width for each cell

how can i find out the exact width size for each tag ??
this code : normalTag.intrinsicContentSize()
returns {-1,-1}

how can i find it out ?

X image

1: How to hide and show click on particular tag an dhow to shift x image to right on tag?
2: How to remove tag without X image click on tag.
3: How to change background and tint color tap on tag.

Tag onClick

not an issue but a request. can you make the tag clickable? or implement onclick on each tag passing the tag name. thanks!

Storyboard and CloudTagView

Hello (it's me again ...),
can i declare in my layout a UIView in CloudTagView and add tag or am I forced to declare my CloudTagView like this "let cloudView = CloudTagView()" in my code ?

Swift 3.0

Hi any plan to upgrade the library to 3.0 ?

dynamic CloudTag UIViewsize

Hello,
I don't using full view.frame.size.
The height of the custom UIView file I created must be related to the number of incoming objects (exam:number of objects x ?). how do i do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.