Iphone 如何在详图视图中传递截面表视图数据

Iphone 如何在详图视图中传递截面表视图数据,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,} 我正在使用这种方式将数据发送到detail view controller,但它会出现异常请尝试在interface builder中检查nib是否存在错误/警告-这可能是因为连接错误。在这种情况下,您尝试在显示DetailView controller时使用self-presentmodalviewcontroller,是否设置了属性和在detailviewcontroller中正确地合成了eventid和affectedid?是的,我有syntesize well event id正在工

}


我正在使用这种方式将数据发送到detail view controller,但它会出现异常

请尝试在interface builder中检查nib是否存在错误/警告-这可能是因为连接错误。

在这种情况下,您尝试在显示DetailView controller时使用
self-presentmodalviewcontroller
,是否设置了属性和在detailviewcontroller中正确地合成了eventid和affectedid?是的,我有syntesize well event id正在工作byt AffectEdate给出了我对两者使用相同的方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

Book1*aBook;

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    UIImageView* img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cell1.png"]];
    [cell setBackgroundView:img];
    [img release];
}



UIImage *image =  [UIImage   imageNamed:@"arrow.png"] ;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
button.frame = frame;
[button setBackgroundImage:image forState:UIControlStateNormal];

[button addTarget:self action:@selector(checkButtonTapped:event:)  forControlEvents:UIControlEventTouchUpInside];
button.backgroundColor = [UIColor clearColor];


cell.accessoryView = button;






if(indexPath.section == 0)
{
    aBook=[appDelegate.books1 objectAtIndex:indexPath.row];
}
else if(indexPath.section == 1)
{
    aBook=[appDelegate.books2 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 2)
{
    aBook=[appDelegate.books3 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 3)
{
    aBook=[appDelegate.books4 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 4)
{
    aBook=[appDelegate.books5 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 5)
{
    aBook=[appDelegate.books6 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 6)
{
    aBook=[appDelegate.books7 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 7)
{
    aBook=[appDelegate.books8 objectAtIndex:indexPath.row];

}

else if(indexPath.section == 8)
{
    aBook=[appDelegate.books9 objectAtIndex:indexPath.row];

}
else if(indexPath.section == 9)
{
    aBook=[appDelegate.books10 objectAtIndex:indexPath.row];

}

    cell.text = aBook.municipality;
    cell.detailTextLabel.text=aBook.title;


  eventId = [NSString stringWithFormat:@"%d", aBook.eventId];
  affectedDate = [NSString stringWithFormat:@"%d", aBook.affecteddate];


    cell.textLabel.backgroundColor=[UIColor clearColor];
    cell.backgroundColor=[UIColor clearColor];
    self.tableView.backgroundColor=[UIColor clearColor];


cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;


return cell;
         - (void)checkButtonTapped:(id)sender event:(id)event
    {
        NSSet *touches = [event allTouches];
   UITouch *touch = [touches anyObject];
   CGPoint currentTouchPosition = [touch locationInView:self.tableView];
   NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
        if (indexPath != nil)
    {
    [self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];


    }
     }




      - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString*myid=eventId;
NSString*date=affectedDate;


DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
dvController.eventId=myid;
dvController.affectedDate=date;

[self.navigationController pushViewController:dvController animated:YES];
[dvController release];






 }