More screenshots available at CocoaControls
See the website for the list of features.
- iOS 7.0+
- ARC
Need support for iOS 6? You shouldn't. But, there's a branch for that!
git checkout iOS6_support_stable
Note: the iOS6_support_stable branch does not include many of the latest hip and fancy features or fixes
# For latest release in cocoapods
pod 'JSQMessagesViewController'
# Feeling adventurous? Get the latest on develop
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'
# For version 5.3.2
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController', :branch => 'version_5.3.2_patch'
# For iOS 6 support
pod 'JSMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'iOS6_support_stable'Otherwise, drag the JSQMessagesViewController/ folder to your project and install JSQSystemSoundPlayer.
NOTE:
This repo was formerly named
MessagesTableViewController.And this pod was formerly named
JSMessagesViewController.
#import <JSQMessagesViewController/JSQMessages.h> // import all the thingsRead the blog post about the 6.0 release!
-
Demo Project
- There's a sweet demo project:
JSQMessages.xcworkspace. - Run
pod installfirst.
- There's a sweet demo project:
-
Message Model
- Your message model objects should conform to the
JSQMessageDataprotocol. - However, you may use the provided
JSQMessageclass.
- Your message model objects should conform to the
-
Media Attachment Model
- Your media attachment model objects should conform to the
JSQMessageMediaDataprotocol. - However, you may use the provided classes:
JSQPhotoMediaItem,JSQLocationMediaItem,JSQVideoMediaItem. - Creating your own custom media items is easy! Simply follow the pattern used by the built-in media types.
- Also see
JSQMessagesMediaViewBubbleImageMaskerfor masking your custom media views as message bubbles.
- Your media attachment model objects should conform to the
-
Avatar Model
- Your avatar model objects should conform to the
JSQMessageAvatarImageDataSourceprotocol. - However, you may use the provided
JSQMessagesAvatarImageclass. - Also see
JSQMessagesAvatarImageFactoryfor easily generating custom avatars.
- Your avatar model objects should conform to the
-
Message Bubble Model
- Your message bubble model objects should conform to the
JSQMessageBubbleImageDataSourceprotocol. - However, you may use the provided
JSQMessagesBubbleImageclass. - Also see
JSQMessagesBubbleImageFactoryandUIImage+JSQMessages.hfor easily generating custom bubbles.
- Your message bubble model objects should conform to the
-
View Controller
- Subclass
JSQMessagesViewController. - Implement the required methods in the
JSQMessagesCollectionViewDataSourceprotocol. - Implement the required methods in the
JSQMessagesCollectionViewDelegateFlowLayoutprotocol. - Set your
senderIdandsenderDisplayName. These properties correspond to the methods found inJSQMessageDataand determine which messages are incoming or outgoing.
- Subclass
-
Customizing
- The demo project is well-commented. Please use this as a guide.
Springy bubbles?
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.collectionView.collectionViewLayout.springinessEnabled = YES;
}Remove avatars?
- (void)viewDidLoad
{
[super viewDidLoad];
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
}
- (id<JSQMessageAvatarImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}Customize your cells?
- (UICollectionViewCell *)collectionView:(JSQMessagesCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
// Customize the shit out of this cell
// See the docs for JSQMessagesCollectionViewCell
return cell;
}Customize your toolbar buttons?






