澎湃iPad上线版本

topicNoDataCell.m 2.5KB

    // // topicNoDataCell.m // ThePaperHD // // Created by YoungLee on 15/5/28. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "topicNoDataCell.h" @interface topicNoDataCell() @property(nonatomic, strong)UIImageView *img; @property(nonatomic, strong)UIButton *btn; @end @implementation topicNoDataCell - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellEditingStyleNone; self.contentView.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; [self.contentView addSubview:self.img]; [self.contentView addSubview:self.btn]; } return self; } -(UIButton *)btn{ if (!_btn) { _btn = [[UIButton alloc] initWithFrame:CGRectZero]; _btn.layer.borderColor = [UIColor colorWithHexString:BLUECOLOR].CGColor; _btn.layer.borderWidth = 1; _btn.layer.cornerRadius = 5; _btn.backgroundColor = [UIColor clearColor]; _btn.titleLabel.font = appFont(15, NO); [_btn setTitle:@"举手问我吧" forState:UIControlStateNormal]; [_btn setTitleColor:[UIColor colorWithHexString:BLUECOLOR] forState:UIControlStateNormal]; [_btn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:BackGroundColor]) forState:UIControlStateNormal]; [_btn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:LIGHTGRAY]) forState:UIControlStateHighlighted]; [_btn addTarget:self action:@selector(btnSelector:) forControlEvents:UIControlEventTouchUpInside]; } return _btn; } -(UIImageView *)img{ if (!_img) { _img = [[UIImageView alloc] initWithFrame:CGRectZero]; _img.image = Image(@"topic/handsup.png"); } return _img; } -(void)btnSelector:(UIButton *) btn{ [MobClick event:@"50"]; if ([self.topicDataDelegate respondsToSelector:@selector(goAsk)]) { [self.topicDataDelegate goAsk]; } } -(void)layoutSubviews{ [super layoutSubviews]; self.btn.frame = CGRectMake(CGRectGetMaxX(self.contentView.bounds)/2 - 106/2, 50, 106, 27); self.img.frame = CGRectMake(CGRectGetMaxX(self.contentView.bounds)/2 - 195/2, CGRectGetMaxY(self.btn.frame)+60, 195, 257); } @end