LuxChat  2.0
Instant messenger for iOS
Instance Methods | Class Methods | Properties | List of all members
JSQMessagesTimestampFormatter Class Reference

#import <JSQMessagesTimestampFormatter.h>

Inheritance diagram for JSQMessagesTimestampFormatter:

Instance Methods

(NSString *) - timestampForDate:
 
(NSAttributedString *) - attributedTimestampForDate:
 
(NSString *) - timeForDate:
 
(NSString *) - relativeDateForDate:
 

Class Methods

(JSQMessagesTimestampFormatter *) + sharedFormatter
 

Properties

NSDateFormatter * dateFormatter
 
NSDictionary * dateTextAttributes
 
NSDictionary * timeTextAttributes
 

Detailed Description

An instance of JSQMessagesTimestampFormatter is a singleton object that provides an efficient means for creating attributed and non-attributed string representations of NSDate objects. It is intended to be used as the method by which you display timestamps in a JSQMessagesCollectionView.

Method Documentation

- (NSAttributedString *) attributedTimestampForDate: (NSDate *)  date

Returns an attributed string representation of the given date formatted as described in timestampForDate:. It applies the attributes in dateTextAttributes and timeTextAttributes, respectively.

Parameters
dateThe date to format.
Returns
A formatted, attributed string representation of date.
See also
- timestampForDate:.
dateTextAttributes.
timeTextAttributes.
- (NSString *) relativeDateForDate: (NSDate *)  date

Returns a string representation of only the day, month, and year components of the given date formatted in the current locale styled using NSDateFormatterMediumStyle.

Parameters
dateThe date to format.
Returns
A formatted string representation of the day, month, and year components of date.
+ (JSQMessagesTimestampFormatter *) sharedFormatter

Returns the shared timestamp formatter object.

Returns
The shared timestamp formatter object.
- (NSString *) timeForDate: (NSDate *)  date

Returns a string representation of only the minute and hour components of the given date formatted in the current locale styled using NSDateFormatterShortStyle.

Parameters
dateThe date to format.
Returns
A formatted string representation of the minute and hour components of date.
- (NSString *) timestampForDate: (NSDate *)  date

Returns a string representation of the given date formatted in the current locale using NSDateFormatterMediumStyle for the date style and NSDateFormatterShortStyle for the time style. It uses relative date formatting where possible.

Parameters
dateThe date to format.
Returns
A formatted string representation of date.

Property Documentation

- (NSDateFormatter*) dateFormatter
readnonatomicstrong

Returns the cached date formatter object used by the JSQMessagesTimestampFormatter shared instance.

- (NSDictionary*) dateTextAttributes
readwritenonatomiccopy

The text attributes to apply to the day, month, and year components of the string representation of a given date. The default value is a dictionary containing attributes that specify centered, light gray text and the bold system font at size 12.0f.

- (NSDictionary*) timeTextAttributes
readwritenonatomiccopy

The text attributes to apply to the minute and hour componenents of the string representation of a given date. The default value is a dictionary containing attributes that specify centered, light gray text and the system font at size 12.0f.


The documentation for this class was generated from the following files: