<div class="meta" robots="noindex">

</div>

Class

# iOSSegmentedControlItem

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `MobileSegment</api/user_interface/mobile/mobilesegment>` as a replacement.

</div>

## Description

An item to display within the SegmentedControl.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                         | Type                                 | Read-Only | Shared |
|----------------------------------------------|--------------------------------------|-----------|--------|
| `Icon<iossegmentedcontrolitem.icon>`         | `iOSImage</api/deprecated/iosimage>` |           |        |
| `Selected<iossegmentedcontrolitem.selected>` | `Boolean</api/data_types/boolean>`   |           |        |
| `Title<iossegmentedcontrolitem.title>`       | `Text</api/deprecated/text>`         |           |        |
| `Width<iossegmentedcontrolitem.width>`       | `Double</api/data_types/double>`     |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                | Parameters                                     | Returns | Shared |
|-----------------------------------------------------|------------------------------------------------|---------|--------|
| `Constructor<iossegmentedcontrolitem.constructor0>` | icon As `Picture</api/graphics/picture>`       |         |        |
| `Constructor<iossegmentedcontrolitem.constructor1>` | title As `String</api/data_types/string>` = "" |         |        |

## Property descriptions

<div id="iossegmentedcontrolitem.icon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Icon

**Icon** As `iOSImage</api/deprecated/iosimage>`

The icon to display.

Although you can have both an Icon and a Title, iOS only shows one of them, preferring the icon if available.

If you use an icon that is too large (about 28x28 seems to be the maximum), you will only see an empty square.

Only the mask for the icon is used, displayed using the tint color for iOS (currently blue), so be sure to use a PNG with an alpha channel.

Changes the icon for the first segment:

``` xojo
MySegmentedControl.Item(0).Icon = MyNewIcon
```

<div id="iossegmentedcontrolitem.selected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Selected

**Selected** As `Boolean</api/data_types/boolean>`

Indicates if the item is selected.

Only one segment can display as selected. If multiple segments have Selected = True, then the last one with Selected = True is the one that displays as selected.

Set the first segment as selected:

``` xojo
MySegmentedControl.Item(0).Selected = True
```

<div id="iossegmentedcontrolitem.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Title

**Title** As `Text</api/deprecated/text>`

The title text of the item.

Although you can have both an Icon and a Title, iOS only shows one of them, preferring the icon if available.

Changes the title for the first segment:

``` xojo
MySegmentedControl.Item(0).Title = "First!"
```

<div id="iossegmentedcontrolitem.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Width

**Width** As `Double</api/data_types/double>`

The width of the item in points. Leave at 0 to have the segment use the available space. If the widths of all segments are 0, then the space will be divided equally amongst the segments.

Change the first segment width:

``` xojo
MySegmentedControl.Item(0).Width = 50
```

## Method descriptions

<div id="iossegmentedcontrolitem.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Constructor

**Constructor**(icon As `Picture</api/graphics/picture>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates an item using the specified image.

<div id="iossegmentedcontrolitem.constructor1">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSSegmentedControlItem.Constructor

**Constructor**(title As `String</api/data_types/string>` = "")

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates an item using the optional title.

In the Open event handler of an iOSSegmentedControl, adds a segment with a title:

``` xojo
Me.Add(New iOSSegmentedControlItem("Moon"))
```

## Compatibility

iOS projects on the iOS operating system.

## See also

`Object</api/data_types/additional_types/object>` parent class; `MobileSegmentedButton</api/user_interface/mobile/mobilesegmentedbutton>`
