tableview 复用
来源:互联网 发布:如何快速提升淘宝等级 编辑:程序博客网 时间:2024/06/06 02:34
用了辣么久的tableview ,居然是错的。。好糗 ╮(╯_╰)╭ 还是记下来好了免得出现不经意地记忆bug.~
#import "oneCell.h"
@implementation oneCell
static int i = 0;
- (void)awakeFromNib {
// Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [superinitWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.contentView.backgroundColor = [UIColorpurpleColor];
UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(0, 0, 200, 20)];
label.textColor = [UIColorblackColor];
label.text =@"label";
[self.contentViewaddSubview:label];
i++;
NSLog(@"%d",i);
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[supersetSelected:selected animated:animated];
}
@end
[_table registerClass:[oneCellclass] forCellReuseIdentifier:@"one"];
------------------------ (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *one =@"one";
static NSString *two =@"two";
if(indexPath.row%2==0){
oneCell *cell;
cell = [tableView dequeueReusableCellWithIdentifier:oneforIndexPath:indexPath];
return cell;
}
else{
TwoCell *cell = [tableViewdequeueReusableCellWithIdentifier:two forIndexPath:indexPath];
return cell;
}
}
- tableview 复用
- ios tableView复用UITableViewHeaderFooterView
- TableView
- TableView
- tableview
- tableview
- tableview
- TableView
- TABLEVIEW
- tableView
- tableView
- TableView
- tableview
- tableview
- tableView
- tableView
- tableView
- tableView
- 【大话设计模式】——行为型模式总结(算法)
- VSM(Vector Space Model)常用向量值计算:TF-IDF
- win7系统中控制面板里面没有添加硬件选项,如何启动添加硬件功能
- js获取富文本编辑器数据
- 查看python调用c++代码的代码实现位于那个cpp文件
- tableview 复用
- 你可能不知道的10个JavaScript小技巧
- js内置对象
- Ireport子报表总结
- svnserve.conf:12: Option expected
- msyql主从读写分离(centos6.5+mysql5.6)
- 常见的字符编码解析
- oc之类别
- matlab中的函数