Class
iOSMobileTableRowAction
Description
An iOSMobileTableRowAction represents a single action that a user can take when swiping horizontally on an iOSMobileTable row. Multiple actions may be added. As of iOS 8 an action is presented as a button near the trailing edge of the row. This class is used in conjunction with the iOSMobileTable event.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
✓ |
|||
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
style As iOSMobileTableRowAction.Styles, title As String, Optional tag As Variant |
Enumerations
iOSMobileTableRowAction.Styles
Styles
A style describes the conceptual role of the action. Destructive, in this context, means actions like deleting a user's data. Normal represents other non-destructive actions. (Normal, Destructive)
Enum |
Description |
---|---|
Destructive |
Apply a style that indicates that the action might change or delete data. This style changes the background to an appropriate value to reflect the destructive action. |
Normal |
Apply a style that reflects standard non-destructive actions. |
Property descriptions
iOSMobileTableRowAction.BackgroundColor
BackgroundColor As Color
The background color for the action.
iOSMobileTableRowAction.Handle
Handle As Ptr
Used for creating Declares to the underlying UITableViewRowAction object.
This property is read-only.
iOSMobileTableRowAction.Image
Image As Picture
The image associated with the action.
iOSMobileTableRowAction.Style
Style As Styles
A value from the Styles enum to indicate how the row action displays.
This property is read-only.
iOSMobileTableRowAction.Tag
Tag As Variant
A value to associate with the action. This value will be passed into the iOSMobileTable event and allows you to determine which action was selected. As a Variant, there are no limitations on the value you supply.
iOSMobileTableRowAction.Title
Title As String
The title of the button. This is displayed to the user and therefore should be localized.
Method descriptions
iOSMobileTableRowAction.Constructor
Constructor(style As iOSMobileTableRowAction.Styles, title As String, Optional tag As Variant)
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Create a new row action that can be returned in iOSMobileTable.
Creates a single action to delete a row (code in iOSMobileTable event):
Var actions(0) As iOSMobileTableRowAction
' Create the Delete button
actions(0) = New iOSMobileTableRowAction(iOSMobileTableRowAction.Styles.Destructive, "Delete", "Delete")
Return actions
Notes
Row actions only work for tables that use iOSMobileTableDataSourceEditing and where its AllowRowEditing method returns True.
Sample code
This class is used in the iOSMobileTable event to set up the actions. The iOSMobileTable event is called when an action is used. This is how you would set it up in the iOSMobileTable events:
Event ApplyActionsForRow(section As Integer, row As Integer) As iOSMobileTableRowAction()
Var actions(1) As iOSMobileTableRowAction
' Create the More button
actions(0) = New iOSMobileTableRowAction(iOSMobileTableRowAction.Styles.Normal, "More...", "More")
' Create the Delete button
actions(1) = New iOSMobileTableRowAction(iOSMobileTableRowAction.Styles.Destructive, "Delete", "Delete")
Return actions
End Event
Event RowActionSelected(section As Integer, row As Integer, actionTag As Variant)
Select Case actionTag
Case "More"
' ... show more info
Case "Delete"
' ... delete something
End Select
End Event
Compatibility
iOS projects on the iOS operating system.
See also
Object parent class; iOSMobileTable class.