Change the width of Master in UISplitViewController

前端 未结 16 1623
自闭症患者
自闭症患者 2020-11-28 05:55

The iPad programming guide says that the splitView\'s left pane is fixed to 320 points. But 320 pixels for my master view controller is too much. I would like to reduce it a

相关标签:
16条回答
  • 2020-11-28 06:50

    No.


    There are two private properties

    @property(access,nonatomic) CGFloat masterColumnWidth;
    @property(access,nonatomic) CGFloat leftColumnWidth; // both are the same!
    

    but being private mean they can't be used for AppStore apps.

    0 讨论(0)
  • 2020-11-28 06:53

    this code is work for me

    [splitViewController setValue:[NSNumber numberWithFloat:200.0] forKey:@"_masterColumnWidth"];
    
    0 讨论(0)
  • 2020-11-28 06:56

    You can use GSSplitViewController. This one will work on iOS 7 and 8

    splitView = [[GSSplitViewController alloc] init];
    splitView.masterPaneWidth = 180;
    

    You can also include it by adding pod 'GSSplitViewController' to your Podfile.

    0 讨论(0)
  • 2020-11-28 06:57

    iOS 8 introduced a new property:

    // An animatable property that can be used to adjust the maximum absolute width of the primary view controller in the split view controller.
    @property(nonatomic, assign) CGFloat maximumPrimaryColumnWidth NS_AVAILABLE_IOS(8_0); // default: UISplitViewControllerAutomaticDimension
    

    Use this property to adjust your master viewcontroller to your desired width.

    0 讨论(0)
提交回复
热议问题