私の(と) に (two arrays
名、姓) があります。この に検索バーを作りたいです。2 つの文字列を持つクラスを作成しました。TableView
cell.textLabel
cell.detailTextLabel
TableView
@interface clientContent : NSObject { }
@property (nonatomic, strong) NSString *clName;
@property (nonatomic, strong) NSString *clLast;
@end
次に、メインクラス(テーブルビューを持つ)に配列を作成し、このような情報を追加しました
for (int i = 0; i < PQntuples(clientQuery); i++)
{
clientContent *cc = [[clientContent alloc] init];
cc.clName = [[NSString alloc] initWithUTF8String:PQgetvalue(clientQuery, i, 0)];
cc.clLast = [[NSString alloc] initWithUTF8String:PQgetvalue(clientQuery, i, 1)];
[allClients addObject:cc];
}
この後、にロードしtableView
ます。
clientContent *cc = [allClients objectAtIndex:indexPath.row];
cell.textLabel.text = cc.clName;
cell.detailTextLabel.text = cc.clLast;
}
それから私は使用します
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
それを正しくする方法は?理解できません..