点击进行编辑

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @CustomCellIdentifier
;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CustomCellIdentifier];
}
for (UIView *subview in cell.contentView.subviews) {
[subview removeFromSuperview];
}
UILabel *descLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 75, 30)];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(85, 10, 150, 30)];
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.delegate = self;
descLabel.font = [UIFont systemFontOfSize:18];
textField.font = [UIFont systemFontOfSize:16];
if ([indexPath row] == 0)
{
descLabel.text = @昵称
;
textField.placeholder = @请输入昵称
;
textField.tag = 0x1001;
textField.text = [HttpService getInstance].userBaseInfo.nickName;
}
else if([indexPath row] == 1)
{
descLabel.text = @手机
;
textField.placeholder = @请输入手机号
;
textField.tag = 0x1002;
textField.text = [HttpService getInstance].userBaseInfo.phone;
}
else if([indexPath row] == 2)
{
descLabel.text = @QQ
;
textField.placeholder = @请输入QQ号
;
textField.tag = 0x1003;
textField.text = [HttpService getInstance].userBaseInfo.qq;
}
else if([indexPath row] == 3)
{
descLabel.text = @支付宝
;
textField.placeholder = @请输入支付宝账号
;
textField.tag = 0x1004;
textField.text = [HttpService getInstance].userBaseInfo.alipayId;
}
else if([indexPath row] == 4)
{
descLabel.text = @推荐人
;
textField.placeholder = @请输入推荐人账号
;
textField.tag = 0x1005;
textField.text = [HttpService getInstance].userBaseInfo.referee;
if (textField.text.length > 0) {
textField.enabled = NO;
}
}
[cell.contentView addSubview:descLabel];
[cell.contentView addSubview:textField];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}

点击事件