mirror of
https://github.com/zhigang1992/MessagesTableViewController.git
synced 2026-04-23 03:49:19 +08:00
bubble cell and bubble view initialiizers
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
@property (strong, nonatomic) JSBubbleView *bubbleView;
|
||||
|
||||
#pragma mark - Initialization
|
||||
- (id)initWithBubbleStyle:(JSBubbleMessageStyle)style
|
||||
reuseIdentifier:(NSString *)reuseIdentifier;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user