Titanium Community Questions & Answer Archive

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

Width of masterview in iPad splitview

Is there a way to control the width of the masterview in the ipad splitview window?

Unfortunately it has a wrong width: a perfect width would be 256. That's the difference between the landscape and portrait width (1024 to 768). The advantage would be that there is no width change in the detailview and ergo no layout changes.

— asked November 23rd 2010 by Sven Wiese-Solty
  • ipad
  • split
  • view
  • width
0 Comments

5 Answers

  • I had the same challenge and managed to solve it for my project.

    If you want to change the default width for ALL SplitViews in your app, you can edit this file just once:

    /Library/Application Support/Titanium/mobilesdk/osx/1.8.2/iphone/Classes/MGSplitView/MGSplitViewController.m

    About line 19 you can change the default splitter width from 320.0 to whatever you prefer:

    #define MG_DEFAULT_SPLIT_POSITION 320.0

    So change that to something like 256.0

    The perform a clean build of your project.

    This will stick for all builds using that SDK. If you download a new Titanium SDK you will need to change it for that SDK as well.

    — answered March 22nd 2012 by Matthew Delmarter
    permalink
    1 Comment
    • Yes it is stick to SDK version, it is well executed in SDK below 1.8.0, They changed object in SDK file so you need more changes to do this, but defiantly, by XCode side you can change width that you want.

      — commented March 23rd 2012 by Gaurang Chhatbar
  • Ok…

    I just measured the width from the masterview in the iOS mail app and it's also 320px.

    Thx

    — answered November 23rd 2010 by Sven Wiese-Solty
    permalink
    0 Comments
  • 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
  • good

    — answered December 1st 2012 by kuldeep singh
    permalink
    0 Comments
  • there is no way to change the width, I don't believe you can change in even if you wrote directly to the iOS SDK

    — answered November 23rd 2010 by Aaron Saunders
    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.