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值嗎? –