Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show time of message? #57

Open
kGopi14 opened this issue May 9, 2018 · 2 comments
Open

How to show time of message? #57

kGopi14 opened this issue May 9, 2018 · 2 comments

Comments

@kGopi14
Copy link

kGopi14 commented May 9, 2018

Hi Team,

Is there any option to show message of time in message cell? I tried to customize the cell but got a linker error. Any suggestion?

Thanks!

@zhuozhuo
Copy link
Owner

zhuozhuo commented May 9, 2018

In the demo you modify the following code:

#pragma mark - Adjusting cell label heights
-(CGFloat)tableView:(ZHCMessagesTableView *)tableView heightForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
    /**
     *  Each label in a cell has a `height` delegate method that corresponds to its text dataSource method
     */
    
    /**
     *  This logic should be consistent with what you return from `attributedTextForCellTopLabelAtIndexPath:`
     *  The other label height delegate methods should follow similarly
     *
     *  Show a timestamp for every 3rd message
     */
    return kZHCMessagesTableViewCellLabelHeightDefault;
        
}


-(NSAttributedString *)tableView:(ZHCMessagesTableView *)tableView attributedTextForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
    /**
     *  This logic should be consistent with what you return from `heightForCellTopLabelAtIndexPath:`
     *  The other label text delegate methods should follow a similar pattern.
     *
     *  Show a timestamp for every 3rd message
     */
    ZHCMessage *message = [self.demoData.messages objectAtIndex:indexPath.row];
    return [[ZHCMessagesTimestampFormatter sharedFormatter]attributedTimestampForDate:message.date];
   
}

@GopiK14
Copy link

GopiK14 commented May 9, 2018

Ok Thanks! I need to show time inside bubble? I think we need to customize the cell, will do. Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants