UA-17470720-3

Jump to content


Photo
- - - - -

select cell at indexPath

actions

  • Please log in to reply
1 reply to this topic

#1 rkelly99

rkelly99

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 20 posts
Reputation: 4
Good

Posted 16 May 2013 - 12:18 AM

I have a side navigation menu that slides to the left to expose a table list of viewControllers. The list displays fine until I put in my cellActions to navigate to the new view controller. When I  implement the cell actions below my list comes up empty. Something else, code hinting tells me I need a semicolon at the end for example " }; " So I am clearly missing something here.

 

 

 

    NSMutableArray *menuItems = [NSMutableArray arrayWithObjects:@"Home",@"Devices",@"Libraries",@"Sensors",@"Alarms",@"Maps",@"Reports",@"Logs",@"ToDos",@"Settings", nil];

    

    SCArrayOfStringsSection *menuSection = [SCArrayOfStringsSection sectionWithHeaderTitle:@"Navigation" items:menuItems];

    

    menuSection.cellActions.didSelect = ^(SCTableViewCell *cell, NSIndexPath *indexPath)

    {

        switch(indexPath.row)

        {

            case 0: // 1st menu item

                if (indexPath.row == 0) {

                    HomeViewController *vc = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];

                    [self.navigationController pushViewController:vc animated:YES];

                }

                break;

                

                

            case 1: // 2nd menu item

                if (indexPath.row == 1) {

                    DeviceViewController *vc = [[DeviceViewController alloc] initWithNibName:@"DeviceViewController" bundle:nil];

                    [self.navigationController pushViewController:vc animated:YES];

                }

                break;

                

            case 2: // 3rd menu item

                

                break;

                

            default:

                 break;

        }

   

        

        [self.tableViewModel addSection:menuSection];

    };

    

 

}


  • gfdhzt6t likes this

#2 Everett

Everett

    Ev

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 191 posts
  • LocationMichigan
Reputation: 60
Outstanding

Posted 16 May 2013 - 07:09 AM

Hi rKelly,

 

looks like you are populating your section from inside of your cell action.

for a quick resolution, try moving:

 

[self.tableViewModel addSection:menuSection];

 

to outside of the cell action block but still inside that method.







Also tagged with one or more of these keywords: actions

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users