开发者

how to display section view from pasring xml result for iphone

ok here is the code

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        #pragma mark parse DetailXml

        //XMLAppDelegate *appDelegate=(XMLAppDelegate*)[UIApplication sharedApplication].delegate;
        Book *aBook = [appDelegate.books objectAtIndex:indexPath.row]; i need this to get id form XMLa

        **uuidd=aBook.uniqueId;** this i need 

        if(bdvController == nil)


        //开发者_C百科  Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];



            bdvController = [[BookDetailViewController alloc] initWithNibName:@"BookDetailView" bundle:[NSBundle mainBundle]];



        //XMLAppDelegate *appDelegate=(XMLAppDelegate*)[UIApplication sharedApplication].delegate;

        //Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];
    DetailXml   *aDetail=[appDelegate.dxml objectAtIndex:indexPath.row];**i want this as my next table secition view will be based on this XMlb  but i am gettingf index out of bound
        bdvController.aDetail = aDetail;**


then here xml paresing is done then this
[self.navigationController pushViewController:bdvController animated:YES];



}

i am getting index Out of bound if i do this DetailXml aDetail=[appDelegate.dxml objectAtIndex:indexPath.row];


You can't just specify the number of sections, you also have to tell the table view which cells are in which specific sections.

Depending on how you set up -tableView:cellForRowAtIndexPath:, you may only be returning table view cells for one section.

If you don't specify more than one section (via indexPath.section) when creating cells, then you will get an out-of-bounds error in -numberOfSectionsInTableView: if you return more than one section there.

You might post code for -tableView:cellForRowAtIndexPath: so we can see what's going on there. But that would be the first place I would look.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜