You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.4 KiB
70 lines
2.4 KiB
1 year ago
|
//
|
||
|
// WatchHomeDevMainCell.m
|
||
|
// tongxin
|
||
|
//
|
||
|
// Created by Apple on 2020/4/8.
|
||
|
// Copyright © 2020 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "WatchHomeDevMainCell.h"
|
||
|
|
||
|
@implementation WatchHomeDevMainCell
|
||
|
|
||
|
- (void)awakeFromNib {
|
||
|
[super awakeFromNib];
|
||
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||
|
// Initialization code
|
||
|
self.contentView.backgroundColor = [UIColor clearColor];
|
||
|
self.backgroundColor = [UIColor clearColor];
|
||
|
[self.deviceMainView setCornerRadius:5];
|
||
|
|
||
|
// 设备头像
|
||
|
[self.deviceMainImageView setCornerRadius:self.deviceMainImageView.width/2.0];
|
||
|
self.deviceMainImageView.userInteractionEnabled = YES;
|
||
|
self.deviceMainImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||
|
UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapActionWithMainDeviceImageView:)];
|
||
|
[self.deviceMainImageView addGestureRecognizer:imageTap];
|
||
|
|
||
|
|
||
|
self.deviceMainLocatTimeLabel.textColor = mainColor; //时间
|
||
|
[self.deviceMainLocatTimeLabel setCornerRadius:3];
|
||
|
self.deviceMainLocatTimeLabel.backgroundColor = RGB(226, 242, 255);
|
||
|
}
|
||
|
|
||
|
- (void)setBattery:(int)battery{
|
||
|
// 电量
|
||
|
NSString *imageName = @"";
|
||
|
if(battery == 0){
|
||
|
imageName = @"icon_home_electricity_0";
|
||
|
}else if (battery < 25) {
|
||
|
imageName = @"icon_home_electricity_25";
|
||
|
}else if (battery < 30) {
|
||
|
imageName = @"icon_home_electricity_30";
|
||
|
}else if (battery < 50) {
|
||
|
imageName = @"icon_home_electricity_50";
|
||
|
}else if (battery < 60) {
|
||
|
imageName = @"icon_home_electricity_60";
|
||
|
}else if (battery < 75) {
|
||
|
imageName = @"icon_home_electricity_75";
|
||
|
}else{
|
||
|
imageName = @"icon_home_electricity_100";
|
||
|
}
|
||
|
self.mainBatteryImageView.image = [myHelper getImageWithName:imageName];
|
||
|
self.mainBatteryLabel.text = [NSString stringWithFormat:@"%d%%",battery];
|
||
|
}
|
||
|
|
||
|
-(void)tapActionWithMainDeviceImageView:(UITapGestureRecognizer *)sender{
|
||
|
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
|
||
|
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"EditDeviceViewController"];
|
||
|
[vc setValue:@(NO) forKey:@"isAdd"];
|
||
|
[self.getViewController.navigationController pushViewController:vc animated:YES];
|
||
|
}
|
||
|
|
||
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||
|
[super setSelected:selected animated:animated];
|
||
|
|
||
|
// Configure the view for the selected state
|
||
|
}
|
||
|
|
||
|
@end
|