From ce824f4fd99cba5ffc7d261710a4aa803466f0d3 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Tue, 9 Oct 2012 19:28:44 +0200 Subject: [PATCH 01/17] Added tableView callback functionality --- src/UIBubbleTableView.m | 7 +++++++ src/UIBubbleTableViewDataSource.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index f189f3a..e6a3b62 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -221,4 +221,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [self.bubbleDataSource didSelectRowAtIndexPath:indexPath]; +} + + @end diff --git a/src/UIBubbleTableViewDataSource.h b/src/UIBubbleTableViewDataSource.h index 01194e7..f59e72d 100644 --- a/src/UIBubbleTableViewDataSource.h +++ b/src/UIBubbleTableViewDataSource.h @@ -20,5 +20,6 @@ - (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView; - (NSBubbleData *)bubbleTableView:(UIBubbleTableView *)tableView dataForRow:(NSInteger)row; +- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath; @end From 14fb9c41b118717e1d0d000cdab04672cfaa8322 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 11 Oct 2012 11:39:59 +0200 Subject: [PATCH 02/17] added custom field for NSBubbleData --- src/NSBubbleData.h | 1 + src/NSBubbleData.m | 1 + 2 files changed, 2 insertions(+) diff --git a/src/NSBubbleData.h b/src/NSBubbleData.h index 0b3f583..0a15c0f 100644 --- a/src/NSBubbleData.h +++ b/src/NSBubbleData.h @@ -22,6 +22,7 @@ typedef enum _NSBubbleType @property (readonly, nonatomic) NSBubbleType type; @property (readonly, nonatomic, strong) UIView *view; @property (readonly, nonatomic) UIEdgeInsets insets; +@property (nonatomic, strong) NSObject *customField; - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; diff --git a/src/NSBubbleData.m b/src/NSBubbleData.m index 621fb82..1acf86b 100644 --- a/src/NSBubbleData.m +++ b/src/NSBubbleData.m @@ -18,6 +18,7 @@ @implementation NSBubbleData @synthesize type = _type; @synthesize view = _view; @synthesize insets = _insets; +@synthesize customField = _customField; #pragma mark - Lifecycle From 0e11b95aff9c820be95c55dd38e74718e587960b Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 11 Oct 2012 12:27:52 +0200 Subject: [PATCH 03/17] bugfix for didSelectRow --- src/UIBubbleTableView.m | 3 ++- src/UIBubbleTableViewDataSource.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index e6a3b62..381481b 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -224,7 +224,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [self.bubbleDataSource didSelectRowAtIndexPath:indexPath]; + NSBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; + [self.bubbleDataSource didSelectNSBubbleDataCell:data]; } diff --git a/src/UIBubbleTableViewDataSource.h b/src/UIBubbleTableViewDataSource.h index f59e72d..6a98c14 100644 --- a/src/UIBubbleTableViewDataSource.h +++ b/src/UIBubbleTableViewDataSource.h @@ -20,6 +20,6 @@ - (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView; - (NSBubbleData *)bubbleTableView:(UIBubbleTableView *)tableView dataForRow:(NSInteger)row; -- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath; +- (void)didSelectNSBubbleDataCell:(NSBubbleData *)dataCell; @end From 37c93f4b34e636a7173c558a4472817b284c2bee Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 13:55:05 +0100 Subject: [PATCH 04/17] Added support for custom font --- src/NSBubbleData.h | 2 ++ src/NSBubbleData.m | 31 ++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/NSBubbleData.h b/src/NSBubbleData.h index 0a15c0f..6e35a4a 100644 --- a/src/NSBubbleData.h +++ b/src/NSBubbleData.h @@ -25,7 +25,9 @@ typedef enum _NSBubbleType @property (nonatomic, strong) NSObject *customField; - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont; + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont; - (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; + (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; - (id)initWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets; diff --git a/src/NSBubbleData.m b/src/NSBubbleData.m index 1acf86b..a9ae602 100644 --- a/src/NSBubbleData.m +++ b/src/NSBubbleData.m @@ -39,24 +39,34 @@ - (void)dealloc const UIEdgeInsets textInsetsSomeone = {5, 15, 11, 10}; + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type +{ + return [self dataWithText:text date:date type:type withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]]; +} + + ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont + { #if !__has_feature(objc_arc) - return [[[NSBubbleData alloc] initWithText:text date:date type:type] autorelease]; + return [[[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont] autorelease]; #else - return [[NSBubbleData alloc] initWithText:text date:date type:type]; -#endif + return [[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont]; +#endif } -- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont { - UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]]; - CGSize size = [(text ? text : @"") sizeWithFont:font constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap]; + if (customFont == nil) { + customFont = [UIFont systemFontOfSize:[UIFont systemFontSize]]; + } + + CGSize size = [(text ? text : @"") sizeWithFont:customFont constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]; label.numberOfLines = 0; label.lineBreakMode = UILineBreakModeWordWrap; label.text = (text ? text : @""); - label.font = font; + label.font = customFont; label.backgroundColor = [UIColor clearColor]; #if !__has_feature(objc_arc) @@ -65,6 +75,13 @@ - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type UIEdgeInsets insets = (type == BubbleTypeMine ? textInsetsMine : textInsetsSomeone); return [self initWithView:label date:date type:type insets:insets]; + +} + +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type +{ + UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]]; + return [self initWithText:text date:date type:type withFont:font]; } #pragma mark - Image bubble From 06a0a2fe1e2cd8e20bcd3dfa64d80cb7015667c3 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 15:23:44 +0100 Subject: [PATCH 05/17] Support for custom font in TableView (ex date labels) --- src/UIBubbleTableView.h | 1 + src/UIBubbleTableView.m | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/UIBubbleTableView.h b/src/UIBubbleTableView.h index 51263ea..06cd128 100644 --- a/src/UIBubbleTableView.h +++ b/src/UIBubbleTableView.h @@ -24,6 +24,7 @@ typedef enum _NSBubbleTypingType @property (nonatomic, assign) id bubbleDataSource; @property (nonatomic) NSTimeInterval snapInterval; +@property (nonatomic, strong) UIFont *customFont; @property (nonatomic) NSBubbleTypingType typingBubble; @end diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index 381481b..bc26d7a 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -25,6 +25,7 @@ @implementation UIBubbleTableView @synthesize snapInterval = _snapInterval; @synthesize bubbleSection = _bubbleSection; @synthesize typingBubble = _typingBubble; +@synthesize customFont = _customFont; #pragma mark - Initializators @@ -208,6 +209,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (cell == nil) cell = [[UIBubbleHeaderTableViewCell alloc] init]; cell.date = data.date; + cell.textLabel.font = _customFont; + cell.detailTextLabel.font = _customFont; return cell; } From 90f7a7ce55ea69507e5cb1dfffe9b00ff718cb56 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 15:31:44 +0100 Subject: [PATCH 06/17] Customized git submodule for messaging to allow custom font color --- src/UIBubbleTableView.h | 1 + src/UIBubbleTableView.m | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/UIBubbleTableView.h b/src/UIBubbleTableView.h index 06cd128..1a9414a 100644 --- a/src/UIBubbleTableView.h +++ b/src/UIBubbleTableView.h @@ -25,6 +25,7 @@ typedef enum _NSBubbleTypingType @property (nonatomic, assign) id bubbleDataSource; @property (nonatomic) NSTimeInterval snapInterval; @property (nonatomic, strong) UIFont *customFont; +@property (nonatomic, strong) UIColor *customFontColor; @property (nonatomic) NSBubbleTypingType typingBubble; @end diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index bc26d7a..d6cb009 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -26,6 +26,7 @@ @implementation UIBubbleTableView @synthesize bubbleSection = _bubbleSection; @synthesize typingBubble = _typingBubble; @synthesize customFont = _customFont; +@synthesize customFontColor = _customFontColor; #pragma mark - Initializators @@ -209,8 +210,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (cell == nil) cell = [[UIBubbleHeaderTableViewCell alloc] init]; cell.date = data.date; - cell.textLabel.font = _customFont; - cell.detailTextLabel.font = _customFont; + if (_customFont != nil) + { + cell.textLabel.font = _customFont; + } + + //cell.detailTextLabel.font = _customFont; //FIXME: how about this? + + if (_customFontColor != nil) + { + cell.textLabel.textColor = _customFontColor; + } return cell; } From c2cb5f587cfe8d35b95e185f115daf620223d94e Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 15:44:07 +0100 Subject: [PATCH 07/17] Extended git submodule for messaging with support for custom colors --- src/NSBubbleData.h | 4 ++-- src/NSBubbleData.m | 17 +++++++++++------ src/UIBubbleTableView.m | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/NSBubbleData.h b/src/NSBubbleData.h index 6e35a4a..a4b8610 100644 --- a/src/NSBubbleData.h +++ b/src/NSBubbleData.h @@ -25,9 +25,9 @@ typedef enum _NSBubbleType @property (nonatomic, strong) NSObject *customField; - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; -- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont; +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont withFontColor:(UIColor*)color; + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; -+ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont; ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont withFontColor:(UIColor*)color; - (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; + (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; - (id)initWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets; diff --git a/src/NSBubbleData.m b/src/NSBubbleData.m index a9ae602..99ced05 100644 --- a/src/NSBubbleData.m +++ b/src/NSBubbleData.m @@ -40,26 +40,30 @@ - (void)dealloc + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type { - return [self dataWithText:text date:date type:type withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]]; + return [self dataWithText:text date:date type:type withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]] withFontColor:[UIColor grayColor]]; } -+ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont withFontColor:(UIColor*)customColor { #if !__has_feature(objc_arc) - return [[[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont] autorelease]; + return [[[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont withFontColor:customColor] autorelease]; #else - return [[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont]; + return [[NSBubbleData alloc] initWithText:text date:date type:type withFont:customFont withFontColor:customColor]; #endif } -- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type withFont:(UIFont*)customFont withFontColor:(UIColor*)customColor { if (customFont == nil) { customFont = [UIFont systemFontOfSize:[UIFont systemFontSize]]; } + if (customColor == nil) { + customColor = [UIColor grayColor]; + } + CGSize size = [(text ? text : @"") sizeWithFont:customFont constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]; @@ -67,6 +71,7 @@ - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type label.lineBreakMode = UILineBreakModeWordWrap; label.text = (text ? text : @""); label.font = customFont; + label.textColor = customColor; label.backgroundColor = [UIColor clearColor]; #if !__has_feature(objc_arc) @@ -81,7 +86,7 @@ - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type { UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]]; - return [self initWithText:text date:date type:type withFont:font]; + return [self initWithText:text date:date type:type withFont:font withFontColor:[UIColor grayColor]]; } #pragma mark - Image bubble diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index d6cb009..5a83fbd 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -213,13 +213,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (_customFont != nil) { cell.textLabel.font = _customFont; + cell.detailTextLabel.font = _customFont; } - //cell.detailTextLabel.font = _customFont; //FIXME: how about this? if (_customFontColor != nil) { cell.textLabel.textColor = _customFontColor; + cell.detailTextLabel.font = _customFont; } return cell; } From a5ab285e0cc7ff9e0b48e92a1d04af7e1432752a Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 15:58:33 +0100 Subject: [PATCH 08/17] Bugfix of custom font color for tableView header section --- src/UIBubbleHeaderTableViewCell.h | 2 ++ src/UIBubbleHeaderTableViewCell.m | 8 +++++++- src/UIBubbleTableView.m | 13 +------------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/UIBubbleHeaderTableViewCell.h b/src/UIBubbleHeaderTableViewCell.h index f7beccf..e1262c8 100644 --- a/src/UIBubbleHeaderTableViewCell.h +++ b/src/UIBubbleHeaderTableViewCell.h @@ -14,4 +14,6 @@ @property (nonatomic, strong) NSDate *date; +-(void)setLabelFont:(UIFont*)customFont withFontColor:(UIColor*)customColor; + @end diff --git a/src/UIBubbleHeaderTableViewCell.m b/src/UIBubbleHeaderTableViewCell.m index 330e825..51188e3 100644 --- a/src/UIBubbleHeaderTableViewCell.m +++ b/src/UIBubbleHeaderTableViewCell.m @@ -50,6 +50,12 @@ - (void)setDate:(NSDate *)value [self addSubview:self.label]; } - +-(void)setLabelFont:(UIFont*)customFont withFontColor:(UIColor*)customColor +{ + + if (customFont != nil) self.label.font = customFont; + if (customColor != nil) self.label.textColor = customColor; + +} @end diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index 5a83fbd..7942077 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -210,18 +210,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (cell == nil) cell = [[UIBubbleHeaderTableViewCell alloc] init]; cell.date = data.date; - if (_customFont != nil) - { - cell.textLabel.font = _customFont; - cell.detailTextLabel.font = _customFont; - } - - - if (_customFontColor != nil) - { - cell.textLabel.textColor = _customFontColor; - cell.detailTextLabel.font = _customFont; - } + [cell setLabelFont:_customFont withFontColor:_customFontColor]; return cell; } From 572d432281b68192135939e0b28b401aa84ada5f Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 19:51:07 +0100 Subject: [PATCH 09/17] White image borders --- .../project.pbxproj | 4 ++++ images/image_frame@2x.png | Bin 0 -> 2235 bytes src/UIBubbleTableViewCell.m | 12 ++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 images/image_frame@2x.png diff --git a/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj b/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj index 0726282..4a39ea2 100644 --- a/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj +++ b/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 76ED208715BF09E300E186D3 /* UIBubbleTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208615BF09E300E186D3 /* UIBubbleTableView.m */; }; 76ED208B15BF0BB100E186D3 /* NSBubbleData.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208A15BF0BB100E186D3 /* NSBubbleData.m */; }; 76ED209415BF29EE00E186D3 /* UIBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */; }; + 9508E66816556D54000C5B04 /* image_frame@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9508E66716556D54000C5B04 /* image_frame@2x.png */; }; C83B107915DE43180067DADE /* bubbleMine.png in Resources */ = {isa = PBXBuildFile; fileRef = C83B107115DE43180067DADE /* bubbleMine.png */; }; C83B107A15DE43180067DADE /* bubbleMine@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C83B107215DE43180067DADE /* bubbleMine@2x.png */; }; C83B107B15DE43180067DADE /* bubbleSomeone.png in Resources */ = {isa = PBXBuildFile; fileRef = C83B107315DE43180067DADE /* bubbleSomeone.png */; }; @@ -59,6 +60,7 @@ 76ED208A15BF0BB100E186D3 /* NSBubbleData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSBubbleData.m; path = ../../src/NSBubbleData.m; sourceTree = ""; }; 76ED209215BF29EE00E186D3 /* UIBubbleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleTableViewCell.h; path = ../../src/UIBubbleTableViewCell.h; sourceTree = ""; }; 76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleTableViewCell.m; path = ../../src/UIBubbleTableViewCell.m; sourceTree = ""; }; + 9508E66716556D54000C5B04 /* image_frame@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image_frame@2x.png"; sourceTree = ""; }; C83B107115DE43180067DADE /* bubbleMine.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bubbleMine.png; sourceTree = ""; }; C83B107215DE43180067DADE /* bubbleMine@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bubbleMine@2x.png"; sourceTree = ""; }; C83B107315DE43180067DADE /* bubbleSomeone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bubbleSomeone.png; sourceTree = ""; }; @@ -162,6 +164,7 @@ C83B107015DE43180067DADE /* images */ = { isa = PBXGroup; children = ( + 9508E66716556D54000C5B04 /* image_frame@2x.png */, C83B107115DE43180067DADE /* bubbleMine.png */, C83B107215DE43180067DADE /* bubbleMine@2x.png */, C83B107315DE43180067DADE /* bubbleSomeone.png */, @@ -238,6 +241,7 @@ C83B107F15DE43180067DADE /* typingSomeone.png in Resources */, C83B108015DE43180067DADE /* typingSomeone@2x.png in Resources */, 76687AFF162203AF00707588 /* halloween.jpg in Resources */, + 9508E66816556D54000C5B04 /* image_frame@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/images/image_frame@2x.png b/images/image_frame@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0dea435ba8a94ea2298da60ea7d9f0ef3fae9969 GIT binary patch literal 2235 zcmaJ@YgAKL8oh+40SYJ}Iw*Gn3Ka5A2nj^qPf4UP5@48?5H1if4{j0?5T^)(6slN6 z5h%=1aZ!UBm?H9;77#6<;USN47WfzyLB!Sy6^bM6+#t|dtHYeN?mg#xcklgu-#Poo zEsSJ`n4@>10RS)$3k~ETvrPAx7$NUV0nBM++93~$mLHTP$(4K<0{jvs2@n`2;wM8K zh@Y65-Vb>LfWDKE8!eA!MKA;s5st6J;8Y?h!Uh0uAC;6ZNQ2~H0+cKiGchkaIx(Oy zk%{3^Sp=3e07?;tX2Hsl+MCI0>ALC(`M3Jb{EKk+28?E6Wti`6{ef z=D4m92+0JnP%0Nn#Gp=*pCD1lnHZ$fcP)sd8?s{A+A$#qhF9^Wcp{FVYiS+GV*P)p zNVI{L$vM!k_5M#`88=f3;W>~@qJRa+#U(lFQb`#BFvOQjV6H@Rc>NS3QzUYUEJY#( z0}fJgM3BW72*tX{Ducyhgo$NxzE}W-1u`*+22LnUWCVKz(>;U89wZu#L?i~0{5|M2 zI>|4)ga&xwK8WIx~o*NajEY7G^++!LURGt~SjOZe9yz zQ@u5A;^wtbH|64yV(_}F{jaND4~d4DL2FnvvAa6n5v&LH z_iXR_&Iw(0RdiDGy1l^!_;kUP51%rO=05ntC9f-%pU(fqb&o}H)(*o@?wDLtwwC?a zujg)*9HJJp(|=DxEyTiULz*d&)1c;O%*DTr{~)KLD(A@I;v&>28h4=LyjhXJ6)Zef zVK;31<>L2!#9^)Pg+(9Hsqt6+axWLx7IsJBu~25iQfHm1#aOtSFQK_G6y^JUz92RIjU;ue z4G)%jw6wH*q|s=;5w%Rt0aRhj^1tb(6*ktgfEIF>k5ac3B~d8>LjdxER* zuu_y(2HOr+_(d1hw#TG=SROZO=fn#qU=`#YKkuIJpI9jNgL~UB|rR?I9I*0bC)LW zL3QlgNq!d}9C~U$XfUPBna+(TRC`-uCO4HMKk z{tMTq?A89`sYxr|JdJ@Cs;Y2nDzD3nrQL3`5@sw@KL45-PSPsS=~B-H??HEebF7TM zjc~4DHe)(IuFx*;L~ZGJR=>nFZ_lZB3)KH0x)$(oxSx$G>{uGGkm1Kz>HLsO6`Usv zXnD)ziYhZx@AwwRjhC~tv(Aqq)K>5RgW@)RnjpD5BA9fV=sAENxmGc2I6RO42 z5h-_ZlygKvEv^3|su%vZ;iIqnyj4c&eO+?xQpCl@=?7F`b?50He^w5BCmPWdq(0(J9zB aj$HsdVF~kgxqDXkI}sMd4%GO^=l%y12z<)` literal 0 HcmV?d00001 diff --git a/src/UIBubbleTableViewCell.m b/src/UIBubbleTableViewCell.m index 64ba822..544c5fb 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/UIBubbleTableViewCell.m @@ -74,7 +74,19 @@ - (void) setupInternalData [self.customView removeFromSuperview]; self.customView = self.data.view; + + if ([self.customView isKindOfClass:[UIImageView class]]) + { + UIImage* imageBorderImg = [[UIImage imageNamed:@"image_frame.png"] stretchableImageWithLeftCapWidth:24 topCapHeight:24]; + UIImageView* whiteBorderView = [[UIImageView alloc] initWithImage:imageBorderImg]; + whiteBorderView.frame = CGRectMake(x + self.data.insets.left-10, y + self.data.insets.top-10, width+20, height+20); + + [self.contentView addSubview:whiteBorderView]; + + } + self.customView.frame = CGRectMake(x + self.data.insets.left, y + self.data.insets.top, width, height); + [self.contentView addSubview:self.customView]; if (type == BubbleTypeSomeoneElse) From e30d653cbdc5d95e5cf1f0c2b76a94bd07f823f7 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 20:01:33 +0100 Subject: [PATCH 10/17] Try 2 to fix white image border --- src/UIBubbleTableViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UIBubbleTableViewCell.m b/src/UIBubbleTableViewCell.m index 544c5fb..f5bb3a2 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/UIBubbleTableViewCell.m @@ -79,7 +79,7 @@ - (void) setupInternalData { UIImage* imageBorderImg = [[UIImage imageNamed:@"image_frame.png"] stretchableImageWithLeftCapWidth:24 topCapHeight:24]; UIImageView* whiteBorderView = [[UIImageView alloc] initWithImage:imageBorderImg]; - whiteBorderView.frame = CGRectMake(x + self.data.insets.left-10, y + self.data.insets.top-10, width+20, height+20); + whiteBorderView.frame = CGRectMake(self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top + self.data.insets.bottom); [self.contentView addSubview:whiteBorderView]; From b138e6fdc03c2ed307a6715ee07951d1955c2088 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 20:04:46 +0100 Subject: [PATCH 11/17] Try 3 to fix white image borders --- src/UIBubbleTableViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UIBubbleTableViewCell.m b/src/UIBubbleTableViewCell.m index f5bb3a2..ee5ce2e 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/UIBubbleTableViewCell.m @@ -79,7 +79,7 @@ - (void) setupInternalData { UIImage* imageBorderImg = [[UIImage imageNamed:@"image_frame.png"] stretchableImageWithLeftCapWidth:24 topCapHeight:24]; UIImageView* whiteBorderView = [[UIImageView alloc] initWithImage:imageBorderImg]; - whiteBorderView.frame = CGRectMake(self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top + self.data.insets.bottom); + whiteBorderView.frame = CGRectMake(x+self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom+4, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top + self.data.insets.bottom); [self.contentView addSubview:whiteBorderView]; From c84ff765d248fba67c599d4227b53be180ff8a19 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 20:11:46 +0100 Subject: [PATCH 12/17] Try 4 for white image borders --- src/UIBubbleTableViewCell.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/UIBubbleTableViewCell.m b/src/UIBubbleTableViewCell.m index ee5ce2e..e6a5fde 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/UIBubbleTableViewCell.m @@ -79,7 +79,14 @@ - (void) setupInternalData { UIImage* imageBorderImg = [[UIImage imageNamed:@"image_frame.png"] stretchableImageWithLeftCapWidth:24 topCapHeight:24]; UIImageView* whiteBorderView = [[UIImageView alloc] initWithImage:imageBorderImg]; - whiteBorderView.frame = CGRectMake(x+self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom+4, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top + self.data.insets.bottom); + int borderX = x; + if (borderX >0) { + borderX+=10; + } + else { + borderX+=2; + } + whiteBorderView.frame = CGRectMake(borderX+self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom+4, width + self.data.insets.left + self.data.insets.right-8, height + self.data.insets.top + self.data.insets.bottom); [self.contentView addSubview:whiteBorderView]; From 45a1ffbe6a833cef98a31b91110398af282f8cd6 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 15 Nov 2012 20:13:21 +0100 Subject: [PATCH 13/17] Finally fixed white border for images --- src/UIBubbleTableViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UIBubbleTableViewCell.m b/src/UIBubbleTableViewCell.m index e6a5fde..05a9d20 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/UIBubbleTableViewCell.m @@ -86,7 +86,7 @@ - (void) setupInternalData else { borderX+=2; } - whiteBorderView.frame = CGRectMake(borderX+self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom+4, width + self.data.insets.left + self.data.insets.right-8, height + self.data.insets.top + self.data.insets.bottom); + whiteBorderView.frame = CGRectMake(borderX+self.data.insets.left - self.data.insets.right, self.data.insets.top - self.data.insets.bottom+4, width + self.data.insets.left + self.data.insets.right-8, height + self.data.insets.top + self.data.insets.bottom-2); [self.contentView addSubview:whiteBorderView]; From 9606780d294c0685547e2c4ab751f299479cf64d Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Wed, 21 Nov 2012 12:44:38 +0100 Subject: [PATCH 14/17] fixed warnings --- src/NSBubbleData.m | 4 ++-- src/UIBubbleHeaderTableViewCell.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NSBubbleData.m b/src/NSBubbleData.m index 99ced05..80d2d47 100644 --- a/src/NSBubbleData.m +++ b/src/NSBubbleData.m @@ -64,11 +64,11 @@ - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type customColor = [UIColor grayColor]; } - CGSize size = [(text ? text : @"") sizeWithFont:customFont constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap]; + CGSize size = [(text ? text : @"") sizeWithFont:customFont constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:NSLineBreakByWordWrapping]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]; label.numberOfLines = 0; - label.lineBreakMode = UILineBreakModeWordWrap; + label.lineBreakMode = NSLineBreakByWordWrapping; label.text = (text ? text : @""); label.font = customFont; label.textColor = customColor; diff --git a/src/UIBubbleHeaderTableViewCell.m b/src/UIBubbleHeaderTableViewCell.m index 51188e3..b5c8f4d 100644 --- a/src/UIBubbleHeaderTableViewCell.m +++ b/src/UIBubbleHeaderTableViewCell.m @@ -42,7 +42,7 @@ - (void)setDate:(NSDate *)value self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, [UIBubbleHeaderTableViewCell height])]; self.label.text = text; self.label.font = [UIFont boldSystemFontOfSize:12]; - self.label.textAlignment = UITextAlignmentCenter; + self.label.textAlignment = NSTextAlignmentCenter; self.label.shadowOffset = CGSizeMake(0, 1); self.label.shadowColor = [UIColor whiteColor]; self.label.textColor = [UIColor darkGrayColor]; From fd3f57c9ee81c2dc439721ecedcbaafd0ff47632 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Tue, 18 Dec 2012 19:03:10 +0100 Subject: [PATCH 15/17] scroll to bottom --- src/UIBubbleTableView.h | 3 +++ src/UIBubbleTableView.m | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/UIBubbleTableView.h b/src/UIBubbleTableView.h index 1a9414a..929d3b3 100644 --- a/src/UIBubbleTableView.h +++ b/src/UIBubbleTableView.h @@ -27,5 +27,8 @@ typedef enum _NSBubbleTypingType @property (nonatomic, strong) UIFont *customFont; @property (nonatomic, strong) UIColor *customFontColor; @property (nonatomic) NSBubbleTypingType typingBubble; +@property (nonatomic) BOOL scrollOnActivity; + +-(void)scrollToBottomAnimated:(BOOL)animated; @end diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index 7942077..0f6c0d0 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -149,6 +149,12 @@ - (void)reloadData } [super reloadData]; + + if(self.scrollOnActivity) + { + [self scrollToBottomAnimated:NO]; + } + } #pragma mark - UITableViewDelegate implementation @@ -232,4 +238,14 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } +-(void)scrollToBottomAnimated:(BOOL)animated; +{ + NSInteger sectionCount = [self numberOfSections]; + NSInteger rowCount = [self numberOfRowsInSection:sectionCount - 1]; + + NSIndexPath* scrollTo = [NSIndexPath indexPathForRow:rowCount-1 inSection:sectionCount - 1]; + [self scrollToRowAtIndexPath:scrollTo atScrollPosition:UITableViewScrollPositionTop animated:animated]; +} + + @end From b6d7b861255e1ae08276ba0460a870dc7ab194f5 Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Thu, 20 Dec 2012 22:51:59 +0100 Subject: [PATCH 16/17] bugfix --- src/UIBubbleTableView.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/UIBubbleTableView.m b/src/UIBubbleTableView.m index 0f6c0d0..a791f9d 100644 --- a/src/UIBubbleTableView.m +++ b/src/UIBubbleTableView.m @@ -233,6 +233,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.row == 0) return; + NSBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; [self.bubbleDataSource didSelectNSBubbleDataCell:data]; } From 54f3e437cacffd8d7ce24219a2b625748c5427dc Mon Sep 17 00:00:00 2001 From: Dennis Korkchi Date: Tue, 7 May 2013 10:55:30 +0200 Subject: [PATCH 17/17] changed table header font color --- src/UIBubbleHeaderTableViewCell.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UIBubbleHeaderTableViewCell.m b/src/UIBubbleHeaderTableViewCell.m index b5c8f4d..7d8ae45 100644 --- a/src/UIBubbleHeaderTableViewCell.m +++ b/src/UIBubbleHeaderTableViewCell.m @@ -44,8 +44,8 @@ - (void)setDate:(NSDate *)value self.label.font = [UIFont boldSystemFontOfSize:12]; self.label.textAlignment = NSTextAlignmentCenter; self.label.shadowOffset = CGSizeMake(0, 1); - self.label.shadowColor = [UIColor whiteColor]; - self.label.textColor = [UIColor darkGrayColor]; + self.label.shadowColor = [UIColor darkGrayColor]; + self.label.textColor = [UIColor whiteColor]; self.label.backgroundColor = [UIColor clearColor]; [self addSubview:self.label]; }