AppleResponder - UBogun/Xojo-iosLib GitHub Wiki

Inherits from AppleObject
Memory leak chec: n/a.
Status: Fairly complete. inputviewcontroller class, UndoManager missing, UserActivity classes must be filled with functions.

This is an implementation of UIResponder, a subclass of NSObject that carries a lot of features available for most of the visible controls, especially touch and motion handling. You do not use NSResponder by itself but one of its many subclasses.

Constructor

no constructor: See above.

Properties

CanBecomeFirstResponder As Boolean (read-only): True if the control can receive the focus.

CanResignFirstResponder As Boolean (read-only): True if the control can lose the focus.

InputAcessoryView As AppleView (read-only): The custom input accessory view to display when the receiver becomes the first responder.

InputAssistantItem As AppleTextInputAssistantitem (read-only): The input assistant to use when configuring the keyboard’s shortcuts bar.

InputView As AppleView (read-only): The custom input view to display when the receiver becomes the first responder.

IsFirstResponder As Boolean (read-only): True if the control has the focus.

KeyCommands As AppleArray (read-only): The key commands that trigger actions on this responder.

NextResponder As AppleResponder (read-only): The next responder in the responder chain.

TextInputContextIdentifier As Text (read-only): An identifier signifying that the responder should preserve its text input mode information.

TextinputMode As AppleTextInputMode (read-only): The text input mode for this responder object.

UserActivity As AppleUserActivity: An object encapsulating a user activity supported by this responder.

Methods

BecomeFirstResponder() As Boolean: Tries to set the focus on the control and returns the result.

ReloadInputViews(): Updates the custom input and accessory views when the object is the first responder.

ResignFirstResponder() As Boolean: Tries to lift the focus from the control and returns the result.

RestoreUserActivityState (UserActivity As AppleUserActivity): Restores the state needed to continue the given user activity.

Hidden methods

(You can use these methods, but they will not appear in Autocomplete. They are mainly for handling methods on iOS level – as long as you don't declare your own, you will not need them)

CanPerformAction (SEL As Ptr, Sender As AppleGeneralObject) As Boolean: Requests the receiving responder to enable or disable the specified command in the user interface.

TargetForAction (SEL As PTr, Sender As AppleGeneralObject) as AppleObject: Returns the target object that responds to an action.

Events

For all events in iOSLib: The easiest way to forward them to other controls is to use AddHandler like you are used to from every Xojo control.

EstimatedPropertiesUpdated (Touchset As AppleSet): Fires when the estimated properties of a touch event change, which means the force of a touch event. Available since iOS 9.1.

MotionBeganwithEvent (type as AppleNSEvent.UIEventSubtype, anEvent as AppleNSEvent): Fires when a motion has begun.

MotionCancelledwithEvent (type as AppleNSEvent.UIEventSubtype, anEvent as AppleNSEvent): Fires when a motion was cancelled.

MotionEndeddwithEvent (type as AppleNSEvent.UIEventSubtype, anEvent as AppleNSEvent): Fires when a motion has finished.

PressesBeganwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when a physical button is pressed in the associated view. Available since iOS 9.

PressesCancelledwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when a system event cancels a press event. Available since iOS 9.

PressesChangedwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when the force of a press changed. Available since iOS 9.

PressesEndedwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when a press event has finished. Available since iOS 9.

TouchesBeganwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when the user touches the control with one or more fingers.

TouchesCancelledwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when a system-event (like low memory) cancels a touch event.

TouchesEndedwithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when the user lifts finger(s)he touched the control with.

TouchesMovedWithEvent (Touchset As AppleSet, anEvent as ApplePressesEvent): Fires when the position of the touch changes. Available since iOS 9.