andreamazz / AMTagListView

UIScrollView subclass that allows to add a list of highly customizable tags.
MIT License
758 stars 110 forks source link

Is there a way to add two different AMTagListView to one view controller? #45

Closed kimi0421 closed 8 years ago

andreamazz commented 8 years ago

Sure, I see no problem in that.

kimi0421 commented 8 years ago

So I just add two AMTagListView? and using [[AMTagView appearance] setTextPadding:CGPointMake(14, 14)] like that to have different properties?

andreamazz commented 8 years ago

If you set a property on the appearance proxy, the next object of that class that you instantiate will have those properties. If you want to have different properties you can set the properties directly on the instantiated object, something like:

self.otherTagView.textPadding = CGPointMake(10, 10);
kimi0421 commented 8 years ago

I see, thank you so much

andreamazz commented 8 years ago

:+1:

kimi0421 commented 8 years ago

But the problem is I found there is no such properties image

kimi0421 commented 8 years ago

You can see it's not working.

andreamazz commented 8 years ago

Oh right, my bad, the text padding is a property of AMTagView.
Ok, in that case you should probably set the text padding on the appearance proxy just before adding the tag in the appropriate list view

kimi0421 commented 8 years ago

So you mean I can add two kinds of text padding on the appearance proxy?

andreamazz commented 8 years ago

You need to switch them when needed. Before adding a tag to the first view, set it to the padding you need, and the same for the second. I know it's not super intuitive.

kimi0421 commented 8 years ago

I see, let me try, Thank you so much

gmogames commented 8 years ago

By the way, setting the properties before adding the tag does not work, the appearance of all tags will always be the last appearance you did. So If i change the background color of a tag before adding and change it again to add a new one, all tag will have the background color of the last one set.