Closed drallgood closed 11 years ago
Sure thing. I'll do it tomorrow.
Awesome. I'd do it myself, but I thought it might be something other developers need as well.
Let me know, if you need any help.
Ok, the menuItems property is now back in commit 382842e432cc33da216285811bd2ff9c9e042e8e I'll wait for a response on another issue before pushing the new version to cocoapods.
Cheers
Sorry to bother you again.
Just making the menu items public again, doesn't solve the issue entirely. In order to change the items shown in the sidebar (once the view was loaded), the tableview also needs to be reloaded.
The tableview is automatically reloaded by the menuItems' setter:
- (void)setMenuItems:(NSArray *)menuItems
{
// Makes sure to refresh the table data when new items are set
_menuItems = [NSMutableArray arrayWithArray:menuItems];
[self.tableView reloadData];
}
Ah! Okay.
I didn't use that method, so I didn't realize it was automatically reloading the tableview.
Thanks for your awesome work!!!
hmm.. That didn't work;
Afterwards, I get an empty table.
Weird... I'll look into it
Check commit 121a52c08f2b0e5d52c7ddf2661db5d3b94f683c It should be ok now.
Yep. That's it!
Thanks for your quick fix. Really appreciate it :)
What I'm seeing is that the easiest way to remove and reset the menu items is to set the array to zero and re-add like the following:
[self.slideoutController setMenuItems:[[NSMutableArray alloc]init]];
UIViewController* controller;
controller = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
[self.slideoutController addViewControllerToLastSection:controller tagged:1 withTitle:cache.user.displayName andIcon:[UIImage imageWithPDFNamed:@"user.pdf" atHeight:44]];
Is that correct? Is there an easier/more efficient way? Thanks.
That's pretty much what I'm doing right now.
Up until your commit today, it was possible to directly manipulate the menuItems array and remove certain entries or clear them out entirely.
Do you think it would be possible to get this functionality back somehow?
I was using it to dynamically add controllers based on data I get from a server.