0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellClassName = @"CarDriverTableViewCell";
CarDriverTableViewCell *cell = (CarDriverTableViewCell *)[tableView dequeueReusableCellWithIdentifier: CellClassName];
if (cell == nil)
{
cell = [[CarDriverTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellClassName];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CarDriverTableViewCell"
owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.backgroundColor=[UIColor blackColor];
}
UILabel *lbltime=(UILabel *)[cell viewWithTag:1];
UILabel *lbldriver=(UILabel *)[cell viewWithTag:2];
UILabel *lbllicence=(UILabel *)[cell viewWithTag:4];
bookbtn=(UIButton *)[cell viewWithTag:5];
// [bookbtn addTarget:self action:@selector(btnclicked:) forControlEvents:UIControlEventTouchUpInside];
lbltime.text=[[arrnames valueForKey:@"time"]objectAtIndex:indexPath.row];
lbldriver.text=[[arrnames valueForKey:@"name"]objectAtIndex:indexPath.row];
lbllicence.text=[[arrnames valueForKey:@"license_plate"]objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
bookbtn.tag=indexPath.row;
[bookbtn addTarget:self action:@selector(btnclicked:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)btnclicked:(id)sender
{
[bookbtn setTitle:@"Pending" forState:UIControlStateNormal];
}
特定のインデックスボタンをクリックすると、ボタンの名前が変わり、残りのセルが選択されます。perticularインデックスボタンをクリックすると、テーブルビューのセルにボタンがあります。
ボタン名の応答を受け入れて拒否すると、自分のテーブルビューのセルだけが選択されます。
その明確ではありません。あなたは何を正確にしたいですか?あなたが直面している問題は何ですか? – iOSEnthusiatic
ボタンを正確に選択するか、またはテーブルビューのセルとあなたの要件は何ですか? – riddhi
私の表内の各セルを1つのボタンが含まれて表示します。私はそのボタンをクリックすると私のボタンのタイトル名が変更され、残りのセルをクリックして選択しません。サーバーからの応答が得られた後(今ボタンのタイトル名)、残りのセルが選択可能になります – Bharath