tags:

views:

31

answers:

1

hello i am trying to add a favorites table cell that loads multiple table cells (which then lead to a detailview) that have been selected by the user. is this even possible?

i am wondering if and how it would be possible to save entries to an array that would load when a table cell is selected. thanks

A: 

Ok here goes if I m correct .

in numberOfRowsInsection

if (myBooleans[section]) {


///we want the number of people plus the header cell
        return [array count] + 1;
} else {
        ///we just want the header cell
        return 1;
}

in didSelectRowAtIndexPath do this

if (indexPath.row == 0) {

        myBooleans[indexPath.section] = !myBooleans[indexPath.section];

        [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] 
                      withRowAnimation:UITableViewRowAnimationFade];

If I am correct this will do the trick you want .

hib
and how would i add another detailview controller to this boolean value you created using an ibaction? im sorry for the stupid questions im just a 16 year old :(
Alex
This boolean values are just to show or hide your favorites . You can do the detailviewcontroller stuff in the didSelectRowAtindexpath method with checking of other row indexes . Do check the uitableviewdelegate protocol may be you will get your solution there .
hib