LuxChat  2.0
Instant messenger for iOS
Instance Methods | List of all members
<JSQMessageData> Protocol Reference

#import <JSQMessageData.h>

Inheritance diagram for <JSQMessageData>:
JSQMessage

Instance Methods

(NSString *) - senderId
 
(NSString *) - senderDisplayName
 
(NSDate *) - date
 
(BOOL) - isMediaMessage
 
(NSUInteger) - messageHash
 
(NSString *) - text
 
(id< JSQMessageMediaData >) - media
 

Detailed Description

The JSQMessageData protocol defines the common interface through which a JSQMessagesViewController and JSQMessagesCollectionView interact with message model objects.

It declares the required and optional methods that a class must implement so that instances of that class can be displayed properly within a JSQMessagesCollectionViewCell.

Two concrete classes that conform to this protocol are provided in the library. See JSQTextMessage and JSQMediaMessage.

See also
JSQMessage.
JSQTextMessage.
JSQMediaMessage.

Method Documentation

- (NSDate *) date
required
Returns
The date that the message was sent.
Warning
You must not return nil from this method.
- (BOOL) isMediaMessage
required

This method is used to determine if the message data item contains text or media. If this method returns YES, an instance of JSQMessagesViewController will ignore the text method of this protocol when dequeuing a JSQMessagesCollectionViewCell and only call the media method.

Similarly, if this method returns NO then the media method will be ignored and and only the text method will be called.

Returns
A boolean value specifying whether or not this is a media message or a text message. Return YES if this item is a media message, and NO if it is a text message.
- (id<JSQMessageMediaData>) media
optional
Returns
The media item of the message.
Warning
You must not return nil from this method.
- (NSUInteger) messageHash
required
Returns
An integer that can be used as a table address in a hash table structure.

This value must be unique for each message with distinct contents. This value is used to cache layout information in the collection view.

- (NSString *) senderDisplayName
required
Returns
The display name for the user who sent the message.
Warning
You must not return nil from this method.
- (NSString *) senderId
required
Returns
A string identifier that uniquely identifies the user who sent the message.

If you need to generate a unique identifier, consider using [[NSProcessInfo processInfo] globallyUniqueString]

Warning
You must not return nil from this method. This value must be unique.
- (NSString *) text
optional
Returns
The body text of the message.
Warning
You must not return nil from this method.

The documentation for this protocol was generated from the following file: