Skip to content

A customizable badge for displaying metadata, especially in UITableViewCells. For iOS.

License

Notifications You must be signed in to change notification settings

EddyBorja/MLPAccessoryBadge

Repository files navigation

MLPAccessoryBadge

"When you have a big table of cells, it helps to have navigation cues that can give you some idea about what you should expect if you were to select a UITableViewCell. A lot of apps use these little badges in a cell's accessory view that contain numbers or text to provide these kind of hints, but there's no simple way to make these... until now. Presenting MLPAccessoryBadge!"

Alt text

About

MLPAccessoryBadge is a delightfully customizable UIView subclass that renders text inside a badge, created mainly for use in a UITableViewCell as its accessoryView property. Use it to hint at quantities, states, notifications, urgency, etc...

An MLPAccessoryBadge is not restricted solely for use in a UITableViewCell, it was just designed with that use case in mind. Feel free to find other creative uses for the accessory badge!

MLPAccessoryBadge requires no graphic files to work, all drawing happens natively. This means you can customize colors, shading and shapes with ease!

Usage

  1. Add the MLPAccessoryBadge.h and MLPAccessoryBadge.m files to your project.

  2. Make sure you have Apple's QuartzCore framework added to your project, MLPAccessoryBadge needs it for drawing routines.

  3. Now it's time to create your badge. Assuming cell is a UITableViewCell for your UITableView, the following code creates a simple gray badge as the accessory view of your cell:

MLPAccessoryBadge *accessoryBadge = [MLPAccessoryBadge new];

[accessoryBadge setText:@"Hello World"];

[cell setAccessoryView:accessoryBadge];

Check the header file of MLPAccessoryBadge to find more customization options.

What to Expect in Future Updates

  • More customization options

  • The ability to insert images into badges.

License

MLPAccessoryBadge uses the MIT License:

Copyright (c) 2013, Mainloop LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Credits

MLPAccessoryBadge was written by Eddy Borja, at Mainloop LLC.

If you make use of MLPAccessoryBadge, tell us about it! Reach us at hello@mainloop.us :D

These days I'm unable to continue working on this project due to other obligations, but I'm always open to pull requests.

More Stuff

Be sure to check out these other libraries:

MLPSpotlight
MLPAutoCompleteTextField
UIColor+MLPFlatColors
EBPhotoPages Gallery

About

A customizable badge for displaying metadata, especially in UITableViewCells. For iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published