messageForRow = [[JSQMessage alloc] initWithSenderId:[[DataArray objectAtIndex:indexPath.row] objectForKey:@"UserId"] senderDisplayName:[[DataArray objectAtIndex:indexPath.row] objectForKey:@"Name"] date:[NSDate distantPast] text: [[DataArray objectAtIndex:indexPath.row] objectForKey:@"Message"]];
Asked
Active
Viewed 325 times
1
1 Answers
1
You ld need to implement these methods to make it visible
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellBottomLabelAtIndexPath:(NSIndexPath *)indexPath {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MMM-yyyy"];//22-Nov-2012
NSString *formattedDateString = [dateFormatter stringFromDate:[[DataArray objectAtIndex:indexPath.row] date]];
return [[NSAttributedString alloc] initWithString:formattedDateString];
}
- (CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView
layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForCellBottomLabelAtIndexPath:(NSIndexPath *)indexPath {
return kJSQMessagesCollectionViewCellLabelHeightDefault;
}

Rajesh
- 10,318
- 16
- 44
- 64
-
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate length]: unrecognized selector sent to instance 0x14779a00' – ragu May 14 '16 at 08:22
-
Sorry we need to feed string for NSAttributedString constructor. See my edit – Rajesh May 14 '16 at 08:27