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.
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.
-
Ok…
I just measured the width from the masterview in the iOS mail app and it's also 320px.
Thx
-
You can set width of masterview in splitview but for that you have to change Titanium compiled code (XCODE source).
follow this steps.
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.Open compiled source from build that is XCODE Project generated from Titanium compilation.
find file "TiUIiPadSplitWindow.m" file in XCODE source from
(Project)\Classes\Modules\UI\iOS\iPad\Split View\TiUIiPadSplitWindow.mput 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]; }
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.
use
Object.splitPosition = value
for examplesplitview.splitPosition = 500
where you want to change your masterview width in the splitview.
-
good
-
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