我在复选框上做一个小概念。实际上,我将复选框图像放在表格单元格中。但我不明白,如何选择特定的复选框并在表格视图中获取单元格的值,任何人都可以帮助我解决这个问题。我会提供带有编码的表格视图的屏幕截图,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"in table view cell for row at index");
RequestSongSelectingCell *cell = (RequestSongSelectingCell *) [tableView dequeueReusableCellWithIdentifier:@"requestsingcell"];
if (cell==nil)
{
[[NSBundle mainBundle] loadNibNamed:@"RequestSongSelectingCell" owner:self options:nil];
NSLog(@"start");
cell=requestingCell;
NSLog(@"end");
}
NSDictionary *dict=[self.array objectAtIndex:indexPath.row];
NSString *artistname=[dict objectForKey:@"artist"];
NSLog(@"artistname is %@",artistname);
cell.artistName.text=artistname;
NSString *songtitle=[dict objectForKey:@"title"];
NSLog(@"songtitle is %@",songtitle);
cell.artistTitle.text=songtitle;
return cell;
}
-(IBAction)checkButtonPressed:(id)sender
{
NSLog(@"check box button pressed");
requestingCell.checkBoxButton.imageView.image=[UIImage imageNamed:@"checkbox-checked.png"];
}
谢谢并恭祝安康,
吉里什