0
我正在做一個小概念複選框。其實,我把複選框圖像放在表格單元格中,但我無法理解,如何選擇特定的複選框並在表格視圖中獲取單元格的值,任何主體都可以通過解決這個問題來幫助我。提供編碼表視圖的屏幕截圖,如何選擇特定的複選框在插入在表格單元接口生成器中的複選框iphone
- (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"];
}
感謝和問候,
吉里什
嗨Vaibhav的感謝烏拉圭回合的響應它的工作,但我有當我當上點擊是在butoon圖像不能改變一個問題(刻度)你可以指導我這樣做。 – girish 2011-03-24 07:19:52
這很棘手,我們維護標籤中單元格的索引,因此不能將其用於選定或未選定的值。您可以將標籤設置爲正面或負面。對未選中的選擇爲正值,對選中的爲負值。這可以成爲解決這個問題的方法之一。我將編輯相同的代碼。 – 2011-03-24 07:28:43
嗨vaibhav感謝它的工作..可以請你轉發我的郵件ID給我。我的郵箱ID是[email protected] – girish 2011-03-24 07:53:55