CocoaPods trunk is moving to be read-only. Read more on the blog, there are 8 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by Kevin Stock.
A UILabel subclass for displaying dates. By default KLSDateLabel will use a relative description ("9 minutes ago", "16 hours from now", etc) for dates within 7 days of the current date (this behavior can be disabled). For dates outside of this range a date formatter is used to transform the date into text. The default date formatter uses a long date style and does not include the time.
Instead of providing a NSString for the label text (as you would do with UILabel), KLSDateLabel uses a NSDate instance which is used to generate the label text:
KLSDateLabel *dateLabel = [[KLSDateLabel alloc] initWithFrame:CGRectMake(20, 20, 280, 40)];
dateLabel.date = [NSDate date];The behavior of KLSDateLabel's can be customized through the properties available. Please see the documentation for more information.
When you install KLSDateLabel through CocoaPods, documentation will be installed into Xcode’s documentation viewer. The documentation is also available online online at CocoaDocs. If you are not using CocoaPods you can manually install the documentation by installing appledoc and running the following command:
$ appledoc -p KLSDateLabel -c "Keivn Stock" --company-id com.tantalic KLSDateLabel/*.hThe recommended way to use KLSDateLabel is with the CocoaPods dependency manager.
Install CocoaPods (if not already installed)
Create a Podfile for your project in the same directory as your Xcode project file:
$ touch PodfileAdd the following line to your Podfile
pod 'KLSDateLabel', '~> 0.0'Update (or create) :
$ pod installAlways open the Xcode workspace (.xcworkspace) instead of the project file to work on your project
If you choose to use the source files directly you are responsible for meeting the following requirements.
KLSDateLabel has only been tested on iOS 5.0 and greater. It may work with previous releases but is not recomended.
KLSDateLabel requires ARC. To use KLSDateLabel in a non-arc project, you will need to set a -fobjc-arc compiler flag on KLSDateLabel.m. To set this compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Expand the "Compile Sources" phase and double click on the KLSDateLabel.m file. Insert -fobjc-arc and click "Done".
KLSDateLabel uses TTTLocalizedPluralString for handling localization strings. The TTTLocalizedPluralString macros work simular to the NSLocalizedString macros but add a count argument.
KLSDateLabel is made available under the MIT license. See the LICENSE file for more info.