| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- //
- // MessageTableCell.m
- // Haishenghai-master
- //
- // Created by GG on 2019/1/5.
- // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
- //
- #import "MessageTableCell.h"
- #define ScreenWidth [UIScreen mainScreen].bounds.size.width
- #define ScreenHeight [UIScreen mainScreen].bounds.size.height
- @implementation MessageTableCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, ScreenWidth-20, 25)];
- // _nameLabel.text = @"独立式烟雾探测报警器";
- _nameLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_nameLabel];
-
- _image =[[UIImageView alloc]init];
- // WithImage:[UIImage imageNamed:@"hsh_home_normal"]];
- _image.frame = CGRectMake(10, 30, 30, 30);
- [self.contentView addSubview:_image];
- //区域名label
- UILabel *nameTitle = [[UILabel alloc]init];
- nameTitle.frame = CGRectMake(45, 25, 60, 20);
- nameTitle.text = @"区域名:";
- nameTitle.font = [UIFont systemFontOfSize:14];
- [self.contentView addSubview:nameTitle];
- //创建传值的label
- _placeLabel = [[UILabel alloc]init];
- _placeLabel.frame = CGRectMake(105, 25, ScreenWidth-105, 20);
- // _locationLabel.text = @"西部科技园。。。。。。";
- _placeLabel.font = [UIFont systemFontOfSize:14];
- _placeLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_placeLabel];
-
- _stateLabel = [[UILabel alloc]init];
- _stateLabel.frame = CGRectMake(45, 45, ScreenWidth-45, 20);
- // _stateLabel.text = @"火警恢复正常";
- _stateLabel.font = [UIFont systemFontOfSize:14];
- _stateLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_stateLabel];
-
- //线
- UIView *lineView = [[UIView alloc]init];
- lineView.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1];
- lineView.frame = CGRectMake(0, 65, ScreenWidth, 1);
- [self.contentView addSubview:lineView];
- //四个标题和图片
- for (int i=0; i<4; i++) {
-
- UIImageView *imageView = [[UIImageView alloc]init];
- NSArray *imageArr = @[@"hsh_news_number",@"hsh_news_location",@"hsh_news_time",@"hsh_news_address"];
- imageView.frame = CGRectMake(20+(20)*(i/4), 68+(20+1)*(i%4), 15, 15);
- imageView.image = [UIImage imageNamed:[imageArr objectAtIndex:i]];
- [self.contentView addSubview:imageView];
-
- UILabel *titlelab= [[UILabel alloc]init];
- titlelab.frame = CGRectMake(45+(50)*(i/4), 65+(20+1)*(i%4), 50, 20);
- NSArray *titles = @[@"编号:",@"位置:",@"时间:",@"地址:"];
- titlelab.text = titles[i];
- titlelab.font = [UIFont systemFontOfSize:14];
- [self.contentView addSubview:titlelab];
- }
- _checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
- // [_checkButton setBackgroundImage:[UIImage imageNamed:@"hsh_news_unaudited"] forState:UIControlStateNormal];
- _checkButton.frame = CGRectMake(ScreenWidth-45, 65, 45, 45);
-
- // _checkView.backgroundColor = [UIColor greenColor];
- [self.contentView addSubview:_checkButton];
-
- _numberLabel = [[UILabel alloc]init];
- _numberLabel.frame = CGRectMake(80, 65, 200, 20);
- // _numberLabel.text = @"123456";
- _numberLabel.font = [UIFont systemFontOfSize:14];
- _numberLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_numberLabel];
-
- _locationLabel = [[UILabel alloc]init];
- _locationLabel.frame = CGRectMake(80, 86, ScreenWidth-60, 20);
- // _locationLabel.text = @"千千万万群多";
- _locationLabel.font = [UIFont systemFontOfSize:14];
- _locationLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_locationLabel];
-
- _timelabel = [[UILabel alloc]init];
- _timelabel.frame = CGRectMake(80, 107, ScreenWidth-60, 20);
- // _timelabel.text = @"2018219e";
- _timelabel.font = [UIFont systemFontOfSize:14];
- _timelabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_timelabel];
-
- _detailLocationLabel = [[UILabel alloc]init];
- _detailLocationLabel.frame = CGRectMake(80, 128, ScreenWidth-60, 20);
- // _detailLocationLabel.text = @"2018219e";
- _detailLocationLabel.font = [UIFont systemFontOfSize:14];
- _detailLocationLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview:_detailLocationLabel];
-
- }
- return self;
- }
- //这里接数据模型用
- //-(void)setModel:(PlaceViewModel *)model{
- // _model = model;
- // self.nameLabel.text = model.title;
- //}
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|