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

#import <JSQMessagesCollectionViewDataSource.h>

Inheritance diagram for <JSQMessagesCollectionViewDataSource>:
JSQMessagesViewController ESChatView

Instance Methods

(NSString *) - senderDisplayName
 
(NSString *) - senderId
 
(id< JSQMessageData >) - collectionView:messageDataForItemAtIndexPath:
 
(id< JSQMessageBubbleImageDataSource >) - collectionView:messageBubbleImageDataForItemAtIndexPath:
 
(id< JSQMessageAvatarImageDataSource >) - collectionView:avatarImageDataForItemAtIndexPath:
 
(NSAttributedString *) - collectionView:attributedTextForCellTopLabelAtIndexPath:
 
(NSAttributedString *) - collectionView:attributedTextForMessageBubbleTopLabelAtIndexPath:
 
(NSAttributedString *) - collectionView:attributedTextForCellBottomLabelAtIndexPath:
 

Detailed Description

An object that adopts the JSQMessagesCollectionViewDataSource protocol is responsible for providing the data and views required by a JSQMessagesCollectionView. The data source object represents your app’s messaging data model and vends information to the collection view as needed.

Method Documentation

- (NSAttributedString *) collectionView: (JSQMessagesCollectionView *)  collectionView
attributedTextForCellBottomLabelAtIndexPath: (NSIndexPath *)  indexPath 
optional

Asks the data source for the text to display in the cellBottomLabel for the the specified message data item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
A configured attributed string or nil if you do not want text displayed for the item at indexPath. Return an attributed string with nil attributes to use the default attributes.
See also
JSQMessagesCollectionViewCell.
- (NSAttributedString *) collectionView: (JSQMessagesCollectionView *)  collectionView
attributedTextForCellTopLabelAtIndexPath: (NSIndexPath *)  indexPath 
optional

Asks the data source for the text to display in the cellTopLabel for the specified message data item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
A configured attributed string or nil if you do not want text displayed for the item at indexPath. Return an attributed string with nil attributes to use the default attributes.
See also
JSQMessagesCollectionViewCell.
- (NSAttributedString *) collectionView: (JSQMessagesCollectionView *)  collectionView
attributedTextForMessageBubbleTopLabelAtIndexPath: (NSIndexPath *)  indexPath 
optional

Asks the data source for the text to display in the messageBubbleTopLabel for the specified message data item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
A configured attributed string or nil if you do not want text displayed for the item at indexPath. Return an attributed string with nil attributes to use the default attributes.
See also
JSQMessagesCollectionViewCell.
- (id<JSQMessageAvatarImageDataSource>) collectionView: (JSQMessagesCollectionView *)  collectionView
avatarImageDataForItemAtIndexPath: (NSIndexPath *)  indexPath 
required

Asks the data source for the avatar image data that corresponds to the specified message data item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
A initialized object that conforms to the JSQMessageAvatarImageDataSource protocol. You may return nil from this method if you do not want the specified item to display an avatar.

It is recommended that you utilize JSQMessagesAvatarImageFactory to return valid JSQMessagesAvatarImage objects. However, you may provide your own data source object as long as it conforms to the JSQMessageAvatarImageDataSource protocol.

See also
JSQMessagesAvatarImageFactory.
JSQMessagesCollectionViewFlowLayout.
- (id<JSQMessageBubbleImageDataSource>) collectionView: (JSQMessagesCollectionView *)  collectionView
messageBubbleImageDataForItemAtIndexPath: (NSIndexPath *)  indexPath 
required

Asks the data source for the message bubble image data that corresponds to the specified message data item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
An initialized object that conforms to the JSQMessageBubbleImageDataSource protocol. You may return nil from this method if you do not want the specified item to display a message bubble image.

It is recommended that you utilize JSQMessagesBubbleImageFactory to return valid JSQMessagesBubbleImage objects. However, you may provide your own data source object as long as it conforms to the JSQMessageBubbleImageDataSource protocol.

Warning
Note that providing your own bubble image data source objects may require additional configuration of the collectionView layout object, specifically regarding its messageBubbleTextViewFrameInsets and messageBubbleTextViewTextContainerInsets.
See also
JSQMessagesBubbleImageFactory.
JSQMessagesCollectionViewFlowLayout.
- (id<JSQMessageData>) collectionView: (JSQMessagesCollectionView *)  collectionView
messageDataForItemAtIndexPath: (NSIndexPath *)  indexPath 
required

Asks the data source for the message data that corresponds to the specified item at indexPath in the collectionView.

Parameters
collectionViewThe object representing the collection view requesting this information.
indexPathThe index path that specifies the location of the item.
Returns
An initialized object that conforms to the JSQMessageData protocol. You must not return nil from this method.
- (NSString *) senderDisplayName
required

Asks the data source for the current sender's display name, that is, the current user who is sending messages.

Returns
An initialized string describing the current sender to display in a JSQMessagesCollectionViewCell.
Warning
You must not return nil from this method. This value does not need to be unique.
- (NSString *) senderId
required

Asks the data source for the current sender's unique identifier, that is, the current user who is sending messages.

Returns
An initialized string identifier that uniquely identifies the current sender.
Warning
You must not return nil from this method. This value must be unique.

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