Skip to content

Commit c364622

Browse files
Alex BarinovAlex Barinov
authored andcommitted
Fix for empty text (bubble was too little in size)
1 parent e156328 commit c364622

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/NSBubbleData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ typedef enum _NSBubbleType
2121

2222
@interface NSBubbleData : NSObject
2323

24-
@property (nonatomic, strong) NSDate *date;
25-
@property (nonatomic) NSBubbleType type;
26-
@property (nonatomic, strong) NSString *text;
24+
@property (readonly, nonatomic, strong) NSDate *date;
25+
@property (readonly, nonatomic) NSBubbleType type;
26+
@property (readonly, nonatomic, strong) NSString *text;
2727

2828
- (id)initWithText:(NSString *)text andDate:(NSDate *)date andType:(NSBubbleType)type;
2929
+ (id)dataWithText:(NSString *)text andDate:(NSDate *)date andType:(NSBubbleType)type;

src/NSBubbleData.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ - (id)initWithText:(NSString *)initText andDate:(NSDate *)initDate andType:(NSBu
2929
self = [super init];
3030
if (self)
3131
{
32-
self.text = initText;
33-
self.date = initDate;
34-
self.type = initType;
32+
text = initText;
33+
if (!text || [text isEqualToString:@""]) text = @" ";
34+
35+
date = initDate;
36+
type = initType;
3537
}
3638
return self;
3739
}

src/UIBubbleTableView.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ - (void)reloadData
7676
for (NSString *key in [bubbleDictionary allKeys])
7777
{
7878
NSMutableArray *array = [bubbleDictionary valueForKey:key];
79-
for (NSObject *object in array) [object release];
79+
for (NSObject *object in array)
80+
{
81+
NSBubbleDataInternal *dataInternal = (NSBubbleDataInternal *)object;
82+
83+
[dataInternal.data release];
84+
[dataInternal release];
85+
}
8086
[array release];
8187
}
8288
[bubbleDictionary release];
@@ -119,7 +125,7 @@ - (void)reloadData
119125
dataInternal.data = (NSBubbleData *)[bubbleData objectAtIndex:i];
120126

121127
// Calculating cell height
122-
dataInternal.labelSize = [dataInternal.data.text sizeWithFont:[UIFont systemFontOfSize:[UIFont systemFontSize]] constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap];
128+
dataInternal.labelSize = [(dataInternal.data.text ? dataInternal.data.text : @"") sizeWithFont:[UIFont systemFontOfSize:[UIFont systemFontSize]] constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap];
123129

124130
dataInternal.height = dataInternal.labelSize.height + 5 + 11;
125131

0 commit comments

Comments
 (0)