// // PushManageCell.m // Haishenghai-master // // Created by GG on 2019/1/10. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved. // #import "PushManageCell.h" #define ScreenWidth [UIScreen mainScreen].bounds.size.width #define ScreenHeight [UIScreen mainScreen].bounds.size.height #import "Header.h" @implementation PushManageCell -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 5, ScreenWidth-40, 25)]; // _titleLabel.text = @"杭州市余杭区仓前街道海智中心3幢"; [self.contentView addSubview:_titleLabel]; for (int i=0; i<2; i++) { _receiveLabel= [[UILabel alloc]init]; _receiveLabel.frame = CGRectMake(50+(120+30)*(i%2), 35+(20)*(i/2), 120, 20); NSArray *titles = @[@"接收火警电话",@"接收短信通知"]; _receiveLabel.text = titles[i]; _receiveLabel.textAlignment = NSTextAlignmentLeft; _receiveLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_receiveLabel]; } _selectTelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _selectTelBtn.frame = CGRectMake(20, 35, 20, 20); [_selectTelBtn setImage:[UIImage imageNamed:@"hsh_news_choice"] forState:UIControlStateNormal]; [_selectTelBtn setImage:[UIImage imageNamed:@"hsh_news_choice_transforma"] forState:UIControlStateSelected]; [self.contentView addSubview:_selectTelBtn]; _selectMsgBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _selectMsgBtn.frame = CGRectMake(170, 35, 20, 20); [_selectMsgBtn setImage:[UIImage imageNamed:@"hsh_news_choice"] forState:UIControlStateNormal]; [_selectMsgBtn setImage:[UIImage imageNamed:@"hsh_news_choice_transforma"] forState:UIControlStateSelected]; [self.contentView addSubview:_selectMsgBtn]; _comitBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _comitBtn.frame = CGRectMake(ScreenWidth-64, 5,60 , 34); _comitBtn.layer.cornerRadius = 12; // _comitBtn.backgroundColor = [UIColor colorWithRed:113/255.0 green:154/255.90 blue:254/255.0 alpha:1]; [_comitBtn setTitle:@"提交" forState:UIControlStateNormal]; [_comitBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // _comitBtn.titleLabel.textColor = [UIColor whiteColor]; _comitBtn.titleLabel.font = [UIFont systemFontOfSize:18]; _comitBtn.titleLabel.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:_comitBtn]; UIView *view = [[UIView alloc]init]; view.frame = CGRectMake(0, 69, ScreenWidth, 3); view.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1]; [self.contentView addSubview:view]; } return self; } //在这里添加frame和约束 //-(void)layoutSubviews{ // //} - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } -(void)setModel:(PlaceModel *)model{ _model = model; NSLog(@"%@",model.isTel); if ([model.isTel isEqualToString:@"1"]) { _selectTelBtn.selected = YES; // [_selectTelBtn setImage:[UIImage imageNamed:@"hsh_news_choice_transforma"] forState:UIControlStateNormal]; }else{ // [_selectTelBtn setImage:[UIImage imageNamed:@"hsh_news_choice"] forState:UIControlStateNormal]; _selectTelBtn.selected = NO; } if ([model.isMsg isEqualToString:@"1"]) { // [_selectMsgBtn setImage:[UIImage imageNamed:@"hsh_news_choice_transforma"] forState:UIControlStateNormal]; _selectMsgBtn.selected = YES; }else{ // [_selectMsgBtn setImage:[UIImage imageNamed:@"hsh_news_choice"] forState:UIControlStateNormal]; _selectMsgBtn.selected = NO; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end