澎湃iPad上线版本

sepicalLiveCell.m 4.5KB

    // // sepicalLiveCell.m // ThePaperHD // // Created by scar1900 on 15/2/13. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "sepicalLiveCell.h" #import "AsyncImageView.h" @interface sepicalLiveCell() @property(nonatomic, strong)UIView *backView; @property(nonatomic, strong)AsyncImageView *liveImageView; @property(nonatomic, strong)UILabel *liveLabel; @property(nonatomic, strong)UIImageView *liveIconView; @property(nonatomic, strong)UILabel *liveIconLabel; @end @implementation sepicalLiveCell @synthesize nodeBO = _nodeBO; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code self.backgroundColor = [UIColor clearColor]; self.selectionStyle = UITableViewCellSelectionStyleNone; [self addSubview:self.liveImageView]; [self addSubview:self.liveLabel]; [self addSubview:self.backView]; [self.backView addSubview:self.liveIconView]; [self.backView addSubview:self.liveIconLabel]; } return self; } - (void)setNodeBO:(nodeObjectBO *)nodeBO { _nodeBO = nodeBO; NSArray *list = nodeBO.contList; if (list.count > 0) { NSDictionary *dic = list[0]; NSString *url = dic[@"pic"]; self.liveImageView.imageUrl = url; self.liveLabel.text = dic[@"name"]; [self layoutSubviews]; } } - (UIView*)backView { if (!_backView) { _backView = [[UIView alloc]initWithFrame:CGRectZero]; _backView.backgroundColor = [UIColor clearColor]; _backView.layer.borderColor = [UIColor colorWithHexString:LINECOLOR].CGColor; _backView.layer.borderWidth = 1; } return _backView; } - (UIImageView*)liveIconView { if (!_liveIconView) { _liveIconView = [[UIImageView alloc]initWithFrame:CGRectZero]; _liveIconView.image = Image(@"topicAndLive/liveImg.png"); } return _liveIconView; } - (UILabel*)liveIconLabel { if (!_liveIconLabel) { _liveIconLabel = [[UILabel alloc]initWithFrame:CGRectZero]; _liveIconLabel.font = appFont(18, NO); _liveIconLabel.textColor = [UIColor colorWithHexString:TextBlack]; _liveIconLabel.text = @"直播中"; _liveIconLabel.backgroundColor = [UIColor clearColor]; } return _liveIconLabel; } - (AsyncImageView*)liveImageView { if (!_liveImageView) { _liveImageView = [[AsyncImageView alloc]initWithFrame:CGRectZero]; } return _liveImageView; } - (UILabel*)liveLabel { if (!_liveLabel) { _liveLabel = [[UILabel alloc]initWithFrame:CGRectZero]; _liveLabel.textAlignment = NSTextAlignmentLeft; _liveLabel.font = appFont(18, NO); _liveLabel.lineBreakMode = NSLineBreakByWordWrapping; _liveLabel.numberOfLines = 0; _liveLabel.textColor = [UIColor colorWithHexString:TextBlack]; _liveLabel.backgroundColor = [UIColor clearColor]; } return _liveLabel; } - (void)layoutSubviews { CGFloat padding = 0; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { padding = 125; } self.liveImageView.frame = CGRectMake(padding, 20, 60, 60); self.liveLabel.frame = CGRectMake(CGRectGetMaxX(self.liveImageView.frame)+12, CGRectGetMinY(self.liveImageView.frame), 1312/2-CGRectGetWidth(self.liveImageView.frame)-15-170/2-12, 60); self.backView.frame = CGRectMake(padding, 20, 1312/2, 60); self.liveIconView.frame = CGRectMake(CGRectGetWidth(self.backView.bounds)-80, 10, 25/2, 20); self.liveIconLabel.frame = CGRectMake(CGRectGetMaxX(self.liveIconView.frame)+5, CGRectGetMinY(self.liveIconView.frame), 112/2, CGRectGetHeight(self.liveIconView.frame)); } - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end