12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #import "HomeInformationCell.h"
- @interface HomeInformationCell ()
- @property (weak, nonatomic) IBOutlet UILabel *messageTitle;
- @property (weak, nonatomic) IBOutlet UILabel *timeLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *messageImage;
- @property (weak, nonatomic) IBOutlet UIView *backView;
- @end
- @implementation HomeInformationCell
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- - (void)configCellWithSource:(HomeMessageModel *)model rowIndex:(ROWINDEX)rowIndex {
- self.messageTitle.text = [NSString returnNoNullStringWithString:model.title];
- self.timeLabel.text = [model.createTime dateFormatString];
- [self.messageImage sd_setImageWithURL:[NSURL URLWithString:[model.coverImage getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
- if (rowIndex == ROWINDEX_TOP) {
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, kScreenWidth - 28, 90) byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = self.backView.bounds;
- maskLayer.path = maskPath.CGPath;
- self.backView.layer.mask = maskLayer;
- }
- else if (rowIndex == ROWINDEX_BOTTOM) {
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, kScreenWidth - 28, 90) byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = self.backView.bounds;
- maskLayer.path = maskPath.CGPath;
- self.backView.layer.mask = maskLayer;
- }
- else if (rowIndex == ROWINDEX_TOP_BOTTOM) {
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, kScreenWidth - 28, 90) byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight|UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = self.backView.bounds;
- maskLayer.path = maskPath.CGPath;
- self.backView.layer.mask = maskLayer;
- }
- else {
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, kScreenWidth - 28, 90) byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(0, 0)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = self.backView.bounds;
- maskLayer.path = maskPath.CGPath;
- self.backView.layer.mask = maskLayer;
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- @end
|