Files
ifish/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m
T
2017-08-15 16:59:01 +08:00

97 lines
2.8 KiB
Objective-C

//
// ifishdeviceListCell.m
// Ifish
//
// Created by imac on 16/6/28.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "ifishdeviceListCell.h"
@implementation ifishdeviceListCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
CGFloat nodH=self.frame.size.height/2;
self.nodImg = [[UIImageView alloc] initWithFrame:CGRectMake(30,nodH/2, nodH, nodH)];
self.nodImg.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.nodImg];
self.deviceNameLabel = [[UILabel alloc] init];
self.deviceNameLabel.frame = CGRectMake(30 + self.nodImg.frame.size.width + 10,nodH/2,self.frame.size.width- 40 -self.nodImg.frame.size.width , nodH);
[self addSubview:self.deviceNameLabel];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setcellImgAtindex:(NSIndexPath *)indexPath
withSelectIndex:(NSIndexPath *)selctIndex{
if (!selctIndex) {
self.nodImg.image = LXImageWithImageName(@"ifish_device_normal");
}else{
if (indexPath.row == selctIndex.row) {
self.nodImg.image = LXImageWithImageName(@"ifish_device_select");
}else{
self.nodImg.image = LXImageWithImageName(@"ifish_device_normal");
}
}
}
-(void)setTitleAtIndex:(NSIndexPath *)indexPath
withdeviceName:(NSString *)nameStr{
self.deviceNameLabel.text = [NSString stringWithFormat:@"水族箱:%@",nameStr];
self.deviceNameLabel.textColor = [UIColor blackColor];
}
//#pragma -mark -functions
//
////获取字符串的宽度
//-(float) widthForString:(NSString *)value fontSize:(float)fontSize andHeight:(float)height
//{
// CGSize sizeToFit = [value sizeWithFont:[UIFont systemFontOfSize:fontSize] constrainedToSize:CGSizeMake(CGFLOAT_MAX, height) lineBreakMode:NSLineBreakByWordWrapping];//此处的换行类型(lineBreakMode)可根据自己的实际情况进行设置
// return sizeToFit.width;
//}
////获得字符串的高度
//-(float) heightForString:(NSString *)value fontSize:(float)fontSize andWidth:(float)width
//{
// CGSize sizeToFit = [value sizeWithFont:[UIFont systemFontOfSize:fontSize] constrainedToSize:CGSizeMake(width, CGFLOAT_MAX) lineBreakMode:NSLineBreakByCharWrapping];//此处的换行类型(lineBreakMode)可根据自己的实际情况进行设置
// return sizeToFit.height;
//}
@end