AlexBarinov / UIBubbleTableView

Cocoa UI component for chat bubbles with avatars and images support
http://alexbarinov.github.com/UIBubbleTableView/
842 stars 232 forks source link

how can i add a Button in each cell ? #34

Open sibahota059 opened 11 years ago

sibahota059 commented 11 years ago

Hi , i want to add a button in each cell (ex: add to favorite) ,if user click the button then He can able to add that chat text as favorite. so how can i add the button to Each cell ? I added in UIBubbleTableViewCell class but the action not calling. any help will be highly appreciated.

iTroyd23 commented 11 years ago

In UIBubbleTableViewCell class add a UILabel (take bubbleImage as sample).

/* adding date and time */

//------------------------------//
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
[dateFormatter setDateFormat:@"HH:mm a"];
NSString * dateText = [[dateFormatter stringFromDate:self.data.date] lowercaseString];

self.timeLabel.text = dateText;
[self.timeLabel setBackgroundColor:[UIColor clearColor]];
self.timeLabel.font = [UIFont fontWithName:@"Lato-Regular" size:9];
self.timeLabel.textColor = UIColorFromRGB(0X4C5559);
[self addSubview:self.timeLabel];
//------------------------------//

if (type == BubbleTypeSomeoneElse) { [self.timeLabel setFrame:CGRectMake(x, -12, 190, 30)]; } else { [self.timeLabel setFrame:CGRectMake(x, -12, 190, 30)]; }