bubble cell and bubble view initialiizers

This commit is contained in:
Jesse Squires
2013-03-19 18:11:11 -04:00
parent c32aaf3274
commit 6636d3d610
4 changed files with 17 additions and 33 deletions

View File

@@ -40,6 +40,7 @@
@property (strong, nonatomic) JSBubbleView *bubbleView;
#pragma mark - Initialization
- (id)initWithBubbleStyle:(JSBubbleMessageStyle)style
reuseIdentifier:(NSString *)reuseIdentifier;

View File

@@ -38,6 +38,7 @@
@interface JSBubbleMessageCell()
- (void)setup;
- (void)configureBubbleWithStyle:(JSBubbleMessageStyle)style;
@end
@@ -59,11 +60,17 @@
self.textLabel.hidden = YES;
self.detailTextLabel.text = nil;
self.detailTextLabel.hidden = YES;
}
- (void)configureBubbleWithStyle:(JSBubbleMessageStyle)style
{
CGRect frame = CGRectMake(0.0f,
0.0f,
self.contentView.frame.size.width,
self.contentView.frame.size.height);
self.bubbleView = [[JSBubbleView alloc] initWithFrame:CGRectMake(0.0f,
0.0f,
self.contentView.frame.size.width,
self.contentView.frame.size.height)];
self.bubbleView = [[JSBubbleView alloc] initWithFrame:frame
bubbleStyle:style];
self.bubbleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
@@ -76,25 +83,7 @@
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
if(self) {
[self setup];
[self.bubbleView setStyle:style];
}
return self;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if(self) {
[self setup];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if(self) {
[self setup];
[self configureBubbleWithStyle:style];
}
return self;
}

View File

@@ -48,6 +48,9 @@ typedef enum {
@property (assign, nonatomic) JSBubbleMessageStyle style;
@property (copy, nonatomic) NSString *text;
#pragma mark - Initialization
- (id)initWithFrame:(CGRect)frame bubbleStyle:(JSBubbleMessageStyle)bubbleStyle;
#pragma mark - Bubble view
+ (UIImage *)bubbleImageForStyle:(JSBubbleMessageStyle)style;
+ (UIFont *)font;

View File

@@ -63,7 +63,7 @@
self.backgroundColor = [UIColor clearColor];
}
- (id)initWithFrame:(CGRect)frame style:(JSBubbleMessageStyle)bubbleStyle
- (id)initWithFrame:(CGRect)frame bubbleStyle:(JSBubbleMessageStyle)bubbleStyle
{
self = [super initWithFrame:frame];
if(self) {
@@ -73,15 +73,6 @@
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if(self) {
[self setup];
}
return self;
}
#pragma mark - Setters
- (void)setStyle:(JSBubbleMessageStyle)newStyle
{