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

#import <JSQMessagesViewController.h>

Inheritance diagram for JSQMessagesViewController:
<JSQMessagesCollectionViewDataSource> <JSQMessagesCollectionViewDelegateFlowLayout> ESChatView

Instance Methods

(void) - didPressSendButton:withMessageText:senderId:senderDisplayName:date:
 
(void) - didPressAccessoryButton:
 
(void) - finishSendingMessage
 
(void) - finishSendingMessageAnimated:
 
(void) - finishReceivingMessage
 
(void) - finishReceivingMessageAnimated:
 
(void) - scrollToBottomAnimated:
 
- Instance Methods inherited from <JSQMessagesCollectionViewDataSource>
(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:
 
- Instance Methods inherited from <JSQMessagesCollectionViewDelegateFlowLayout>
(CGFloat) - collectionView:layout:heightForCellTopLabelAtIndexPath:
 
(CGFloat) - collectionView:layout:heightForMessageBubbleTopLabelAtIndexPath:
 
(CGFloat) - collectionView:layout:heightForCellBottomLabelAtIndexPath:
 
(void) - collectionView:didTapAvatarImageView:atIndexPath:
 
(void) - collectionView:didTapMessageBubbleAtIndexPath:
 
(void) - collectionView:didLongTapMessageBubbleAtIndexPath:
 
(void) - collectionView:didTapCellAtIndexPath:touchLocation:
 
(void) - collectionView:header:didTapLoadEarlierMessagesButton:
 

Class Methods

(UINib *) + nib
 
(instancetype) + messagesViewController
 

Properties

JSQMessagesCollectionViewcollectionView
 
JSQMessagesInputToolbarinputToolbar
 
JSQMessagesKeyboardControllerkeyboardController
 
NSString * senderDisplayName
 
NSString * senderId
 
BOOL automaticallyScrollsToMostRecentMessage
 
NSString * outgoingCellIdentifier
 
NSString * outgoingMediaCellIdentifier
 
NSString * incomingCellIdentifier
 
NSString * incomingMediaCellIdentifier
 
BOOL showTypingIndicator
 
BOOL showLoadEarlierMessagesHeader
 
CGFloat topContentAdditionalInset
 

Detailed Description

The JSQMessagesViewController class is an abstract class that represents a view controller whose content consists of a JSQMessagesCollectionView and JSQMessagesInputToolbar and is specialized to display a messaging interface.

Warning
This class is intended to be subclassed. You should not use it directly.

Method Documentation

- (void) didPressAccessoryButton: (UIButton *)  sender

This method is called when the user taps the accessory button on the inputToolbar.

Parameters
senderThe accessory button that was pressed by the user.
- (void) didPressSendButton: (UIButton *)  button
withMessageText: (NSString *)  text
senderId: (NSString *)  senderId
senderDisplayName: (NSString *)  senderDisplayName
date: (NSDate *)  date 

This method is called when the user taps the send button on the inputToolbar after composing a message with the specified data.

Parameters
buttonThe send button that was pressed by the user.
textThe message text.
senderIdThe message sender identifier.
senderDisplayNameThe message sender display name.
dateThe message date.
- (void) finishReceivingMessage

Animates the receiving of a new message. See finishReceivingMessageAnimated: for more details.

See also
- finishReceivingMessageAnimated:.
- (void) finishReceivingMessageAnimated: (BOOL)  animated

Completes the "receiving" of a new message by showing the typing indicator, adding a new collection view cell in the collection view, reloading the collection view, and scrolling to the newly sent message as specified by automaticallyScrollsToMostRecentMessage. Scrolling to the new message can be animated as specified by the animated parameter.

Parameters
animatedSpecifies whether the receiving of a message should be animated or not. Pass YES to animate changes, NO otherwise.

You should call this method after adding a new "received" message to your data source and performing any related tasks.

See also
automaticallyScrollsToMostRecentMessage.
- (void) finishSendingMessage

Animates the sending of a new message. See finishSendingMessageAnimated: for more details.

See also
- finishSendingMessageAnimated:.
- (void) finishSendingMessageAnimated: (BOOL)  animated

Completes the "sending" of a new message by resetting the inputToolbar, adding a new collection view cell in the collection view, reloading the collection view, and scrolling to the newly sent message as specified by automaticallyScrollsToMostRecentMessage. Scrolling to the new message can be animated as specified by the animated parameter.

Parameters
animatedSpecifies whether the sending of a message should be animated or not. Pass YES to animate changes, NO otherwise.

You should call this method at the end of didPressSendButton: withMessageText: senderId: senderDisplayName: date after adding the new message to your data source and performing any related tasks.

See also
automaticallyScrollsToMostRecentMessage.
+ (instancetype) messagesViewController

Creates and returns a new JSQMessagesViewController object.

This is the designated initializer for programmatic instantiation.

Returns
An initialized JSQMessagesViewController object if successful, nil otherwise.
+ (UINib *) nib

Returns the UINib object initialized for a JSQMessagesViewController.

Returns
The initialized UINib object or nil if there were errors during initialization or the nib file could not be located.

You may override this method to provide a customized nib. If you do, you should also override messagesViewController to return your view controller loaded from your custom nib.

- (void) scrollToBottomAnimated: (BOOL)  animated

Scrolls the collection view such that the bottom most cell is completely visible, above the inputToolbar.

Parameters
animatedPass YES if you want to animate scrolling, NO if it should be immediate.

Property Documentation

- (BOOL) automaticallyScrollsToMostRecentMessage
readwritenonatomicassign

Specifies whether or not the view controller should automatically scroll to the most recent message when the view appears and when sending, receiving, and composing a new message.

The default value is YES, which allows the view controller to scroll automatically to the most recent message. Set to NO if you want to manage scrolling yourself.

- (JSQMessagesCollectionView*) collectionView
readnonatomicweak

Returns the collection view object managed by this view controller. This view controller is the collection view's data source and delegate.

- (NSString*) incomingCellIdentifier
readwritenonatomiccopy

The collection view cell identifier to use for dequeuing incoming message collection view cells in the collectionView for text messages.

This cell identifier is used for incoming text message data items. The default value is the string returned by [JSQMessagesCollectionViewCellIncoming cellReuseIdentifier]. This value must not be nil.

See also
JSQMessagesCollectionViewCellIncoming.
Warning
Overriding this property's default value is not recommended. You should only override this property's default value if you are proividing your own cell prototypes. These prototypes must be registered with the collectionView for reuse and you are then responsible for completely overriding many delegate and data source methods for the collectionView, including collectionView:cellForItemAtIndexPath:.
- (NSString*) incomingMediaCellIdentifier
readwritenonatomiccopy

The collection view cell identifier to use for dequeuing incoming message collection view cells in the collectionView for media messages.

This cell identifier is used for incoming media message data items. The default value is the string returned by [JSQMessagesCollectionViewCellIncoming mediaCellReuseIdentifier]. This value must not be nil.

See also
JSQMessagesCollectionViewCellIncoming.
Warning
Overriding this property's default value is not recommended. You should only override this property's default value if you are proividing your own cell prototypes. These prototypes must be registered with the collectionView for reuse and you are then responsible for completely overriding many delegate and data source methods for the collectionView, including collectionView:cellForItemAtIndexPath:.
- (JSQMessagesInputToolbar*) inputToolbar
readnonatomicweak

Returns the input toolbar view object managed by this view controller. This view controller is the toolbar's delegate.

- (JSQMessagesKeyboardController*) keyboardController
readwritenonatomicstrong

Returns the keyboard controller object used to manage the software keyboard.

- (NSString*) outgoingCellIdentifier
readwritenonatomiccopy

The collection view cell identifier to use for dequeuing outgoing message collection view cells in the collectionView for text messages.

This cell identifier is used for outgoing text message data items. The default value is the string returned by [JSQMessagesCollectionViewCellOutgoing cellReuseIdentifier]. This value must not be nil.

See also
JSQMessagesCollectionViewCellOutgoing.
Warning
Overriding this property's default value is not recommended. You should only override this property's default value if you are proividing your own cell prototypes. These prototypes must be registered with the collectionView for reuse and you are then responsible for completely overriding many delegate and data source methods for the collectionView, including collectionView:cellForItemAtIndexPath:.
- (NSString*) outgoingMediaCellIdentifier
readwritenonatomiccopy

The collection view cell identifier to use for dequeuing outgoing message collection view cells in the collectionView for media messages.

This cell identifier is used for outgoing media message data items. The default value is the string returned by [JSQMessagesCollectionViewCellOutgoing mediaCellReuseIdentifier]. This value must not be nil.

See also
JSQMessagesCollectionViewCellOutgoing.
Warning
Overriding this property's default value is not recommended. You should only override this property's default value if you are proividing your own cell prototypes. These prototypes must be registered with the collectionView for reuse and you are then responsible for completely overriding many delegate and data source methods for the collectionView, including collectionView:cellForItemAtIndexPath:.
- (NSString*) senderDisplayName
readwritenonatomiccopy

The display name of the current user who is sending messages.

This value does not have to be unique. This value must not be nil.

- (NSString*) senderId
readwritenonatomiccopy

The string identifier that uniquely identifies the current user sending messages.

This property is used to determine if a message is incoming or outgoing. All message data objects returned by collectionView:messageDataForItemAtIndexPath: are checked against this identifier. This value must not be nil.

- (BOOL) showLoadEarlierMessagesHeader
readwritenonatomicassign

Specifies whether or not the view controller should show the "load earlier messages" header view.

Setting this property to YES will show the header view immediately. Settings this property to NO will hide the header view immediately. You will need to scroll to the top of the collection view in order to see the header.

- (BOOL) showTypingIndicator
readwritenonatomicassign

Specifies whether or not the view controller should show the typing indicator for an incoming message.

Setting this property to YES will animate showing the typing indicator immediately. Setting this property to NO will animate hiding the typing indicator immediately. You will need to scroll to the bottom of the collection view in order to see the typing indicator. You may use scrollToBottomAnimated: for this.

- (CGFloat) topContentAdditionalInset
readwritenonatomicassign

Specifies an additional inset amount to be added to the collectionView's contentInsets.top value.

Use this property to adjust the top content inset to account for a custom subview at the top of your view controller.


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