Question

I'm trying to resize my sidebar, but the changes are only reflecting after the only time I open the sidebar.

@implementation MenuViewController

- (void)viewDidLoad
{
    [self.frostedViewController setLimitMenuViewSize:TRUE];
    [self.frostedViewController setMenuViewSize:CGSizeMake(200, [[UIScreen mainScreen] bounds].size.height)];
}

If someone could help me, that would be great.

Thank you!

Was it helpful?

Solution

You could put these configurations in the REFrostedViewController subclass. For example (supposing you are using storyboards), you could configure the menu right below the view controllers assignment, e.g. (but, remember, you can put the config everywhere in the REFrostedViewController initialization code)

- (void)awakeFromNib
{
    self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
    self.menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"menuViewController"];

    self.limitMenuViewSize  = YES;
    self.menuViewSize       = CGSizeMake(200.0, [UIScreen mainScreen].bounds.size.height);
}

Doing this configuration in the MenuViewController viewDidLoad method causes the config to be applied only AFTER the menu view is loaded for the first time, and so your changes show up only the second time.

Just put the code in the REFrostedViewController subclass (or even in the contentViewController you are using) and you should be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top