Class

iOSView


Warning

This item was deprecated in version 2020r2. Please use MobileScreen as a replacement.

Description

The View is where you design your iOS layouts.

Enumerations

iOSView.LargeTitleModes

LargeTitleModes

Used to specify the value for the LargeTitleMode property. (Automatic, Always, Never) Available in 2018r2.

Enum

Description

Automatic

Keep the title bar in whatever state is was for the previous screen.

Always

The title is always displayed large, regardless of the previous screen.

Never

The title never displays in large size.

Property descriptions


iOSView.BackButtonTitle

BackButtonTitle As Text

The back button that gets back to this View uses the text specified here.

This title does not appear on the back button for this View, but instead appears on the back button for any Views shown by this View (using PushTo). It is the title for the back button that goes back to this view.

Self.BackButtonTitle = "Customers"

iOSView.BottomLayoutGuide

BottomLayoutGuide As Object

The bottom layout guide for the View. For use when creating iOSLayoutConstraints.

This property is read-only.

For a View, iOSLayoutConstraint.AttributeTypes. Bottom is the absolute bottom of the View. BottomLayoutGuide is adjusted for things such as a Toolbar or TabBar.


iOSView.LargeTitleMode

LargeTitleMode As LargeTitleModes

Enable and controls how titles render in iOS 11+ using the LargeTitleModes enumeration, which has these elements: Automatic, Always, Never (the default). This property does nothing on pre-iOS 11 versions. Available in 2018r2.


iOSView.LeftNavigationToolbar

LeftNavigationToolbar As iOSToolbar

The toolbar to display at the left of the Navigation Bar. Only visible when NavigationBarVisible = True.

Add a button to the left Navigation Bar:

LeftNavigationToolbar.Add(iOSToolButton.NewSystemItem(iOSToolButton.Types.SystemAdd))

iOSView.NavigationBarVisible

NavigationBarVisible As Boolean

Indicates whether the Navigation Bar is visible. The Navigation Bar must be visible in order to see the Title, LeftNavigationToolbar, RightNavigationToolbar or Back button.

Display the Navigation Bar:

Self.NavigationBarVisible = True

iOSView.ParentSplitView

ParentSplitView As iOSSplitView

Indicates the split view that is the owner of this View. It is Nil is there is no split view. A split view can only be used on iPad devices.

This property is read-only.

Use this property to determine if a SplitView is displayed. You can then use it to get access to the Master and Detail views that are displayed.

If a SplitView is used, then populate the detail side, otherwise, push a new view onto the screen:

If Self.ParentSplitView <> Nil Then
  ' On Action event for a Table on a Master view of the SplitView.
  ' Gets the Text for the selected row and
  ' assigns it to a Label on the DetailView of the SplitView.
  DetailView(Self.ParentSplitView.Detail).Label1.Text = Me.RowData(section, row).Text
Else
  ' No SplitView, so this is a phone.
  ' Display the Detail view and update the text for its label.
  Var d As New DetailView
  d.Label1.Text = Me.RowData(section, row).Text
  Self.PushTo(d)
End If

iOSView.ParentTabBar

ParentTabBar As iOSTabBar

Indicates the Tab Bar that is the owner of this View. It is Nil if there is no Tab Bar.

This property is read-only.

Add a new View to the Tab Bar:

' This code (on a View) adds View3 to the Tab Bar
If Self.ParentTabBar <> Nil Then
  Var v As New View3
  Self.ParentTabBar.AddTab(v)
End If

iOSView.RightNavigationToolbar

RightNavigationToolbar As iOSToolbar

The toolbar to display at the right of the Navigation Bar. Only visible when NavigationBarVisible = True.

Add a button to the right Navigation Toolbar:

RightNavigationToolbar.Add(iOSToolButton.NewSystemItem(iOSToolButton.Types.SystemAdd))

iOSView.TabIcon

TabIcon As iOSImage

The icon for the tab that this View is displayed on.


iOSView.TabTitle

TabTitle As Text

The title for the tab that this View is displayed on.


iOSView.Title

Title As Text

The title for the Navigation Bar. This only appears if NavigationBarVisible is True.

Change the title for the View:

Self.Title = "My View"

iOSView.Toolbar

Toolbar As iOSToolbar

The toolbar that is displayed in the View, typically at the bottom.

Add a button to the Toolbar:

Toolbar.Add(iOSToolButton.NewSystemItem(iOSToolButton.Types.SystemAdd))

iOSView.TopLayoutGuide

TopLayoutGuide As Object

The top layout guide for the View. For use when creating iOSLayoutConstraints.

This property is read-only.

For a View, iOSLayoutConstraint.AttributeTypes. Top is the absolute top of the View. TopLayoutGuide is adjusted for things such as a NavigationBar.

Method descriptions


iOSView.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

Adds the constraint to the view.


iOSView.AddControl

AddControl(child As MobileControl)

Adds a control to the View.

Add a control to the View:

Var ctrl As New iOSSwitch
' Send its ValueChanged event to the SwitchValueChanged method on the View
AddHandler ctrl.ValueChanged, AddressOf SwitchValueChanged
Self.AddControl(ctrl)

iOSView.Close

Close

For views that were displayed using PushTo, this closes the View causing the previous View to display.

Since calling Close displays the previous View, you can call it to simulate the user pressing a "Back" button on the View.

You cannot close the main View (the one that is specified as the Content for the Screen), however you can swap in another view by using the iOSApplication.CurrentScreen property.


iOSView.Constraint

Constraint(name As String) As iOSLayoutConstraint

Gets a reference to a named constraint so that you can modify its settings in code.

Change an existing (and named) constraint of a control on the View:

' "TAWidth" is a width constraint for a TextField that has been given
' a name in the auto-layout Inspector properties.
Var c As iOSLayoutConstraint = Self.Constraint("TAWidth")
c.Offset = 200

iOSView.ContentSize

ContentSize As Size

The size (in points) of the content area of the View. This excludes the Navigation Bar, Tab Bar and Toolbar if they are on the View.

Get the content size of the View:

Var screenSize As Text = Self.ContentSize.Width.ToText + " by " + Self.ContentSize.Height.ToText

iOSView.Control

Control(index As Integer) As MobileControl

Gets the control at the 0-based index.

Get the name of the first control on the View:

Var controlName As Text = Self.Control(0).Name

iOSView.ControlCount

ControlCount As Integer

The number of controls on the view.

Get the number of controls on the View:

Var count As Integer = Self.ControlCount

iOSView.Handle

Handle As Ptr

The handle to use when creating Declares to UIView.


iOSView.PushTo

PushTo(newView As iOSView)

Displays a new view by "pushing" it onto the current View.

PushTo displays a new View over the current View, placing it on the "stack" so that the back functionality of the new View can be used to go back to the original View. If you need to just change the current View without affecting the stack, you can do so by using the iOSApplication.CurrentScreen property.

Use the Close method to close the new View and go back to the View that called "PushTo".

Displays a new View on the screen:

Var newView As New View2
Self.PushTo(newView)

iOSView.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes the constraint from the View.


iOSView.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the View.


iOSView.Size

Size As Size

The size (in points) of the entire View area.

Get the size of the View:

Var screenSize As Text = Self.Size.Width.ToText + " by " + Self.Size.Height.ToText

Event descriptions


iOSView.Activate

Activate

Called when the View is activated.

This occurs when: * the View first opens * the View is displayed again after a View that was pushed onto it is closed (either by calling the Close method or by the user tapping the Back button)


iOSView.AppearanceChanged

AppearanceChanged(dark As Boolean)

Called when a user switches between Light and Dark mode.

Use this event to update any graphics or other UI as needed.


iOSView.Close

Close

Called when the View is closed by calling the Close method.

This is called by the Destructor.


iOSView.Deactivate

Deactivate

Called when the View is deactivated.

This occurs when: * the View is closed by calling the Close method or the user tapping the Back button * another View is opened (pushed) onto this view


iOSView.Open

Open

Called when the View first appears and typically used for initialization.

This event is called by the Constructor.


iOSView.Resized

Resized

Called when the View is resized, which can occur when the device orientation changes.


iOSView.ToolbarPressed

ToolbarPressed(button As MobileToolbarButton)

Called when a button on the left or right Navigation Bar or the Toolbar is pressed.

Check for a button pressed based on its caption:

Select Case button.Caption
  Case "Save"
    ' call save code
  Case "Edit"
    ' call edit code
End Select

Check for a button pressed based on its name:

Select Case button.Caption
  Case SaveButton
    ' call save code
  Case EditButton
    ' call edit code
End Select

Check for a button pressed based on its type:

Select Case button.Type
Case iOSToolButton.Types.SystemSave
  ' call save code
Case iOSToolButton.Types.SystemEdit
  ' call edit code
End Select

Compatibility

iOS projects on the iOS operating system.

See also

Object parent class; iOSLayoutConstraint, iOSSplitView, iOSTabBar, MobileToolbar classes;