Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

SplitWindow widths

Hi there,

Are the width of the two panes in a SplitWindow fixed, or is it possible to change these? Adjusting the width of each window doesn't seem to have an effect, but maybe I'm doing it wrong - this is what I'm trying (adapted from the iPad kitchen sink):

SplitViewNav = {};

SplitViewNav.masterWindow = Ti.UI.createWindow({
    title:'Master',
    backgroundColor:'red',
    width: 513
});

SplitViewNav.detailWindow = Ti.UI.createWindow({
    title:'Detail',
    backgroundColor:'#336699',
    width: 510
});

SplitViewNav.splitView = Titanium.UI.iPad.createSplitWindow({
    masterView:SplitViewNav.masterNav,
    detailView:SplitViewNav.detailNav
});

Thanks,

Toby

— asked September 24th 2010 by Toby Mathews
  • ipad
  • splitwindow
2 Comments
  • Anyone able to cast any light on this?

    — commented September 27th 2010 by Toby Mathews
  • Hi,

    Did you ever get an answer to this?

    regards

    — commented November 15th 2010 by derek johnston

1 Answer

  • You can set width of masterview in splitview but for that you have to change Titanium compiled code (XCODE source).

    follow this steps.

    1. Compile Titanium source code, Note that splitview must contain property showMasterInPortrait = ture that supported in 1.7.2 SDK. this property shows masterview in portrait mode.

    2. Open compiled source from build that is XCODE Project generated from Titanium compilation.

    3. find file "TiUIiPadSplitWindow.m" file in XCODE source from
      (Project)\Classes\Modules\UI\iOS\iPad\Split View\TiUIiPadSplitWindow.m

    4. put following code into file at line no 125

    -(void)setSplitPosition_:(id)value
    {
        float splitPos = [TiUtils floatValue:value];
        MGSplitViewController* splitController = (MGSplitViewController*)[self controller];
        [splitController setSplitPosition:splitPos animated:YES];
    
        [[self proxy] replaceValue:value forKey:@"splitPosition" notification:NO];
    }
    
    1. clean and build source code from XCODE and run the code. Note do not compile again in Titanium. whenever you clean your build you have to follow all this steps again.

    2. use Object.splitPosition = value for example splitview.splitPosition = 500 where you want to change your masterview width in the splitview.

    — answered October 21st 2011 by Gaurang Chhatbar
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.