UIView+JTAnnotatedView

UIView+JTAnnotatedView

There has been a need in one of my projects to show a list of users by their avatars. Determining who that user is was the challenge, in that how to show their name? So I wanted to make an easy way project wide that I could make a view tappable and that would show and auto position the users name. A perfect candidate for a category against UIView!

UIView+JTAnnotatedView is just that 🙂 It creates a subview, inserts it and positions it in the view’s super view and binds a tap gesture to the view to show and hide the annotation. It also taps into touchesBegan to know if there was a touch outside of the UIView that the tap gesture didn’t pick up on to dismiss any annotations displayed.

The category supports custom font for the annotation and setting the title via view.annotatedTitle. It’s my first category so feedback welcome!

Grab it from: https://github.com/voidet/UIView-JTAnnotatedView

Posted by voidet

Categorised under ios
Bookmark the permalink or leave a trackback.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

or