0
如何搜索cell.textLabel.text
值与textfield
?我正在使用此代码。如何使用此代码在tableview中使用搜索栏?
- (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:@"[email protected]"];
[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;
}
你的意思是,当你在搜索栏输入文本。它应该填充tableview中的数据吗? –
如何搜索没有数组的cell.textlabel.text值。 – user2951709
我的观点是,你想在搜索栏中传递这个cell.textlabel.text值吗? –