# Titanium.UI.iOS.SplitWindow

> A SplitWindow is a window that manages the presentation of two side-by-side view controllers.

- Source: https://titaniumsdk.com/docs/sdk/12.7.1/Titanium.UI.iOS.SplitWindow
- Titanium SDK version: 12.7.1
- Kind: view
- Platforms: iPhone, iPad, macOS
- Since: Titanium SDK iPhone 3.6.0, iPad 3.6.0, macOS 9.2.0
- Extends: Titanium.UI.Window
- Inheritance: Titanium.UI.Window > Titanium.UI.View > Titanium.Proxy

The [masterView](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#masterView) and [detailView](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#detailView) 
properties are required before the SplitWindow is opened.

You use this class to implement a master-detail interface, in which the left-side view presents
a list of items and the right-side presents details of the selected item. The `SplitWindow` is supported
for both iPhone and iPad idioms. Use the [Titanium.UI.iOS.createSplitWindow](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.md#createSplitWindow) method to create a `SplitWindow` object

By default, `SplitWindow` shows both master and detail views in landscape orientation. When the
device switches into portrait orientation, the master is only shown if [showMasterInPortrait](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#showMasterInPortrait)
is set to true.

The property [masterIsOverlayed](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#masterIsOverlayed) controls how the master is
displayed in portrait mode. When `masterIsOverlayed` is set to true, the `detailView` occupies the full screen
and and `masterView` is displayed overlayed on top to the left of the screen. When `masterIsOverlayed` is set
to false, the available screen width is split between the `masterView` and `detailView`.

The width of the `masterView` can be controlled by the [portraitSplit](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#portraitSplit) and
[landscapeSplit](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#landscapeSplit) properties. These values are capped in the range 0.25 to 0.5.
Any values outside this range are ignored.

To add a navigation bar to either the master or detail view of the split window,
use a [Titanium.UI.NavigationWindow](https://titaniumsdk.com/docs/sdk/Titanium.UI.NavigationWindow.md).

The SplitWindow is a top-level window and cannot be contained within another window or view.

## Example: Split Window

This is an example of a Split Window.

``` js
var detail = Ti.UI.createWindow({ backgroundColor: 'white' });
var label1 = Ti.UI.createLabel({ text: 'Detail View' });
detail.add(label1);
var detailNav = Ti.UI.createNavigationWindow({ window: detail });

var master = Ti.UI.createWindow({ backgroundColor: 'gray' });
var label2 = Ti.UI.createLabel({ text: 'Master View' });
master.add(label2);
var masterNav = Ti.UI.createNavigationWindow({ window: master });

var splitWin = Ti.UI.iOS.createSplitWindow({
    detailView: detailNav,
    masterView: masterNav
});
splitWin.open();
```

## Example: Alloy XML Markup

Below is an Alloy version of the previous example. The first window is the `masterView` and the second window is the `detailView`. You can also use the `<Require>` element to add a `<Window>` or `<NavigationWindow>`.

**views/index.xml:**
``` xml
<Alloy>
  <SplitWindow backgroundColor="white" showMasterInPortrait="true">

    <!-- First window is the masterView -->
    <NavigationWindow>
      <Window title="Master View">
        <ListView>
          <ListSection headerTitle="Some items">
            <ListItem title="Item 1" />
            <ListItem title="Item 2" />
            <ListItem title="Item 3" />
          </ListSection>
        </ListView>
      </Window>
    </NavigationWindow>

    <!-- Second window is the detailView -->
    <NavigationWindow>
      <Window title="Detail View">
        <Label>I am the detail view.</Label>
      </Window>
    </NavigationWindow>
  </SplitWindow>
</Alloy>
```

**controllers/index.js:**
``` js
$.index.open();
```

## Properties

### detailView

- Type: Titanium.UI.Window
- Platforms: iPhone, iPad, macOS

Window for the detail view section of the SplitWindow.

### landscapeSplit

- Type: Number
- Platforms: iPhone, iPad, macOS
- Default: `The width of the master-view divided by the screen-height`

Determines the width of the `masterView` in landscape mode.

These values are capped in the range 0.25 to 0.5. Any values outside this range are ignored.

### masterIsOverlayed

- Type: Boolean
- Platforms: iPhone, iPad, macOS
- Default: `false`

Determines whether to show the master view is overlayed in portrait orientation.

Note that you need to set `showMasterInPortrait` to `true` if you want to use
this property in portrait mode.

### masterView

- Type: Titanium.UI.Window
- Platforms: iPhone, iPad, macOS

Window for the master view section of the SplitWindow.

### masterViewVisible

- Type: Boolean
- Platforms: iPhone, iPad, macOS
- Default: `true`

Determines whether to show the master view or hide.

### portraitSplit

- Type: Number
- Platforms: iPhone, iPad, macOS
- Default: `The width of the master-view divided by the screen-width`

Determines the width of the `masterView` in portrait mode.

These values are capped in the range 0.25 to 0.5. Any values outside this range are ignored.

### showMasterInPortrait

- Type: Boolean
- Platforms: iPhone, iPad, macOS
- Default: `false`

Determines whether to show the master view in portrait orientation.

## Methods

### setMasterIsOverlayed

- Platforms: iPhone, iPad, macOS

Sets the value of the [masterIsOverlayed](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#masterIsOverlayed) property.

Parameters:

- `masterIsOverlayed` (Boolean): Determines whether to show the master view is overlayed in portrait orientation.
- `options` (AnimatedOptions, optional): Determines whether the scrollable region reposition should be animated. On iOS, use the optional property `animated` to animate changes to masterView display mode in portrait orientation. For example ``` js setMasterIsOverlayed(true, { animated: true }); ``` Note that the default here is equivalent to passing in `{ animated: false }` Default: `{ animated: false }`.

### setShowMasterInPortrait

- Platforms: iPhone, iPad, macOS

Sets the value of the [showMasterInPortrait](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.SplitWindow.md#showMasterInPortrait) property.

Parameters:

- `showMasterInPortrait` (Boolean): Determines whether to show the master view in portrait orientation.
- `options` (AnimatedOptions, optional): Determines whether the scrollable region reposition should be animated. On iOS, use the optional property `animated` to animate changes to masterView display mode in portrait orientation. For example ``` js setShowMasterInPortrait(true, { animated: true }); ``` Note that the default here is equivalent to passing in `{ animated: false }` Default: `{ animated: false }`.

## Inherited members

131 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/12.7.1/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `removeEventListener`
- [Titanium.UI.View](https://titaniumsdk.com/docs/sdk/12.7.1/Titanium.UI.View.md): `accessibilityHidden`, `accessibilityHint`, `accessibilityLabel`, `accessibilityValue`, `add`, `anchorPoint`, `animate`, `animatedCenter`, `backgroundGradient`, `backgroundImage`, `backgroundLeftCap`, `backgroundRepeat`, `backgroundTopCap`, `borderColor`, `borderRadius`, `borderWidth`, `center`, `children`, `clearMotionEffects`, `click`, `clipMode`, `convertPointToView`, `dblclick`, `doubletap`, `getViewById`, `height`, `hide`, `horizontalMotionEffect`, `horizontalWrap`, `id`, `insertAt`, `keypressed`, `layout`, `longpress`, `pinch`, `postlayout`, `previewContext`, `pullBackgroundColor`, `rect`, `remove`, `replaceAt`, `rotate`, `rotation`, `show`, `singletap`, `size`, `swipe`, `tintColor`, `toImage`, `tooltip`, `touchEnabled`, `touchcancel`, `touchend`, `touchmove`, `touchstart`, `transform`, `twofingertap`, `verticalMotionEffect`, `viewShadowColor`, `viewShadowOffset`, `viewShadowRadius`, `visible`, `width`, `zIndex`
- [Titanium.UI.Window](https://titaniumsdk.com/docs/sdk/12.7.1/Titanium.UI.Window.md): `autoAdjustScrollViewInsets`, `backButtonTitle`, `backButtonTitleImage`, `backgroundColor`, `barColor`, `barImage`, `blur`, `bottom`, `close`, `close`, `closed`, `extendEdges`, `extendSafeArea`, `focus`, `focused`, `fullscreen`, `hideNavBar`, `hideShadow`, `hideTabBar`, `hideToolbar`, `hidesBackButton`, `hidesBarsOnSwipe`, `hidesBarsOnTap`, `hidesBarsWhenKeyboardAppears`, `hidesSearchBarWhenScrolling`, `homeIndicatorAutoHidden`, `includeOpaqueBars`, `largeTitleDisplayMode`, `largeTitleEnabled`, `left`, `leftNavButton`, `leftNavButtons`, `modal`, `navBarHidden`, `navTintColor`, `navigationWindow`, `opacity`, `open`, `open`, `orientation`, `orientationModes`, `right`, `rightNavButton`, `rightNavButtons`, `safeAreaPadding`, `shadowImage`, `showNavBar`, `showTabBar`, `showToolbar`, `statusBarStyle`, `tabBarHidden`, `title`, `titleAttributes`, `titleControl`, `titleImage`, `titlePrompt`, `titleid`, `titlepromptid`, `toolbar`, `top`, `translucent`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

