I am doing a small concept on check box. Actually, i placed the check box image in the table cell.But i can't understand, how to select the particular check box and get the value of the cell in table view, Can any body help me by solving this problem.I will provide the screen shots of table view with coding,
- (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"];
}
Thanks and regards,
girish
Are you adding a button on the RequestSongSelectingCell.xib file?
When you add it on the tableView, you can set the tag property of it. And then you can retrieve tag in the buttonPressed method.
EDIT: To handle selection