Search code examples
iosuisplitviewcontroller

Refresh UISplitViewController after changing the Master's width


I am using iOS 6.0. From this post, I know I could use

[splitViewController setValue:[NSNumber numberWithFloat:10] forKey:@"_masterColumnWidth"];

To change the width of master view.(I do not need to upload my app to AppStore).

But I found this only works in my AppDelegate, before

[self.window makeKeyAndVisible];

For example, it does not work in my MasterViewController viewDidLoad method

I guessed it is because the splieViewController does not reloadView after changing this "_masterColumnWidth" property. What should I do next if I want to change the Master Column width in MasterViewController?

Could you please throw some light on this issue?

Thanks in advance.


Solution

  • This works for me:

    [splitViewController.view setNeedsLayout];
    

    I use it to show/hide the MasterViewContoller in landscape mode.