如何使用cell.textLabel.text
搜索textfield
值?我正在使用此代码。
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
UITextField* tf = nil ;
switch ( indexPath.row ) {
case 0: {
cell.textLabel.text = @"Name" ;
tf = nameField_ = [self makeTextField:self.name placeholder:@"sathish"];
[cell addSubview:nameField_];
break ;
}
case 1: {
cell.textLabel.text = @"Address" ;
tf = addressField_ = [self makeTextField:self.address placeholder:@"example@gmail.com"];
[cell addSubview:addressField_];
break ;
}
case 2: {
cell.textLabel.text = @"Password" ;
tf = passwordField_ = [self makeTextField:self.password placeholder:@"Required"];
[cell addSubview:passwordField_];
break ;
}
case 3: {
cell.textLabel.text = @"Description" ;
tf = descriptionField_ = [self makeTextField:self.description placeholder:@"My Gmail Account"];
[cell addSubview:descriptionField_];
break ;
}
}
tf.frame = CGRectMake(120, 12, 170, 30);
[tf addTarget:self action:@selector(textFieldFinished:) forControlEvents:UIControlEventEditingDidEndOnExit];
tf.delegate = self ;
return cell;
}
答案 0 :(得分:1)
基本步骤:
这个受欢迎的链接你会得到更多的想法