好久不用代码实现自定义UItableViewCell
2017-11-06 15:47
369 查看
类似这样需要用户输入的时候要想到用户输入完信息后因为滑动的关系有可能信息未被保存,这个时候我们可以想到三种方案来解决
planA :因为cell不多就考虑cell不复用- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.placeTFPlaceHolder = [[UITextField alloc]initWithFrame:CGRectMake(self.frame.size.width-200, 20, 180, 100)];
[self.contentView addSubview:self.placeTFPlaceHolder];
self.contentView.backgroundColor = [UIColor redColor];
}
return self;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString * ID = [NSString stringWithFormat:@"%ld",indexPath.row]; CustomerTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (cell == nil) { cell = [[CustomerTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID]; } //给cell中得属性framemodel赋值 cell.textLabel.text = self.dataSource[indexPath.row]; cell.placeTFPlaceHolder.placeholder = self.dataSource[indexPath.row]; return cell; }planB:利用UITextfiled的代理去实现
破烂C:利用代理储存用户已经输入的信息去实现。
相关文章推荐
- IOS中xib+代码实现自定义cell中嵌套
- 通过代码自定义cell(cell的高度不一致)实现新浪微博界面
- 自定义UITableViewCell (通过代码实现:每个CELL格式不一样)
- 纯代码自定义cell,并且实现动态调整
- 通过代码自定义cell——实现qq聊天界面(Version 2 实现聊天内容的背景)
- 猫猫学IOS(十七)UI之纯代码自定义Cell实现新浪微博UI
- iOS8 用UITableViewRowAction实现Cell自定义滑动操作
- 猫猫学IOS(十七)UI之纯代码自定义Cell实现新浪微博UI
- AJ学IOS(17)UI之纯代码自定义Cell实现新浪微博UI
- (素材源码)猫猫学IOS(十七)UI之纯代码自定义Cell实现新浪微博UI
- (素材源码)猫猫学IOS(十七)UI之纯代码自定义Cell实现新浪微博UI
- 纯代码实现自定义UITableView的cell
- UITableView 之 点击cell 实现两个自定义cell之间的切换
- AutoLayout自定义tableViewCell --- Masonry + UITableView+FDTemplateLayoutCell 纯代码实现
- UITableViewCell自定义--代码自定义 和 xib自定义
- 代码自定义UITableViewCell
- iOS8 用UITableViewRowAction实现Cell自定义滑动操作
- iOS个人整理20-UITableViewCell自定义,cell高度的自适应(纯代码)
- 一. 使用代码实现UITableView的cell自定义高度-类似于微博主页
- iPhone开发——通过代码自定义cell实现qq聊天界面