Class: UIControl
Overview
Direct Known Subclasses
UIButton, UIDatePicker, UIPageControl, UIRefreshControl, UISegmentedControl, UISlider, UIStepper, UISwitch, UITextField
Instance Attribute Summary (collapse)
-
- contentHorizontalAlignment
The horizontal alignment of content (text or image) within the receiver.
-
- contentVerticalAlignment
The vertical alignment of content (text or image) within the receiver.
-
- enabled
A Boolean value that determines whether the receiver is enabled.
-
- highlighted
A Boolean value that determines whether the receiver is highlighted.
-
- selected
A Boolean value that determines the receiver’s selected state.
-
- state
readonly
A Boolean value that indicates the state of the receiver.
-
- touchInside
readonly
A Boolean value that indicates whether a touch is inside the bounds of the receiver.
-
- tracking
readonly
A Boolean value that indicates whether the receiver is currently tracking touches related to an event.
Attributes inherited from UIView
#alpha, #autoresizesSubviews, #autoresizingMask, #backgroundColor, #bounds, #center, #clearsContextBeforeDrawing, #clipsToBounds, #contentMode, #contentScaleFactor, #exclusiveTouch, #frame, #gestureRecognizers, #hidden, #layer, #multipleTouchEnabled, #opaque, #restorationIdentifier, #subviews, #superview, #tag, #transform, #userInteractionEnabled, #window
Attributes inherited from UIResponder
#inputAccessoryView, #inputView, #undoManager
Instance Method Summary (collapse)
-
- actionsForTarget:forControlEvent:
Returns the actions that are associated with a target and a particular control event.
-
- addTarget:action:forControlEvents:
Adds a target and action for a particular event (or events) to an internal dispatch table.
-
- allControlEvents
Returns all control events associated with the receiver.
-
- allTargets
Returns all target objects associated with the receiver.
-
- beginTrackingWithTouch:withEvent:
Sent to the control when a touch related to the given event enters the control’s bounds.
-
- cancelTrackingWithEvent:
Tells the control to cancel tracking related to the given event.
-
- continueTrackingWithTouch:withEvent:
Sent continuously to the control as it tracks a touch related to the given event within the control’s bounds.
-
- endTrackingWithTouch:withEvent:
Sent to the control when the last touch for the given event completely ends, telling it to stop tracking.
-
- removeTarget:action:forControlEvents:
Removes a target and action for a particular event (or events) from an internal dispatch table.
-
- sendAction:to:forEvent:
In response to a given event, forwards an action message to the application object for dispatching to a target.
-
- sendActionsForControlEvents:
Sends action messages for the given control events.
Methods inherited from UIView
#addConstraint:, #addConstraints:, #addGestureRecognizer:, #addSubview:, #alignmentRectForFrame:, #alignmentRectInsets, animateWithDuration:animations:, animateWithDuration:animations:completion:, animateWithDuration:delay:options:animations:completion:, areAnimationsEnabled, beginAnimations:context:, #bringSubviewToFront:, commitAnimations, #constraints, #constraintsAffectingLayoutForAxis:, #contentCompressionResistancePriorityForAxis:, #contentHuggingPriorityForAxis:, #convertPoint:fromView:, #convertPoint:toView:, #convertRect:fromView:, #convertRect:toView:, #decodeRestorableStateWithCoder:, #didAddSubview:, #didMoveToSuperview, #didMoveToWindow, #drawRect:, #drawRect:forViewPrintFormatter:, #encodeRestorableStateWithCoder:, #endEditing:, #exchangeSubviewAtIndex:withSubviewAtIndex:, #exerciseAmbiguityInLayout, #frameForAlignmentRect:, #gestureRecognizerShouldBegin:, #hasAmbiguousLayout, #hitTest:withEvent:, #initWithFrame:, #insertSubview:aboveSubview:, #insertSubview:atIndex:, #insertSubview:belowSubview:, #intrinsicContentSize, #invalidateIntrinsicContentSize, #isDescendantOfView:, layerClass, #layoutIfNeeded, #layoutSubviews, #needsUpdateConstraints, #pointInside:withEvent:, #removeConstraint:, #removeConstraints:, #removeFromSuperview, #removeGestureRecognizer:, requiresConstraintBasedLayout, #sendSubviewToBack:, setAnimationBeginsFromCurrentState:, setAnimationCurve:, setAnimationDelay:, setAnimationDelegate:, setAnimationDidStopSelector:, setAnimationDuration:, setAnimationRepeatAutoreverses:, setAnimationRepeatCount:, setAnimationStartDate:, setAnimationTransition:forView:cache:, setAnimationWillStartSelector:, setAnimationsEnabled:, #setContentCompressionResistancePriority:forAxis:, #setContentHuggingPriority:forAxis:, #setNeedsDisplay, #setNeedsDisplayInRect:, #setNeedsLayout, #setNeedsUpdateConstraints, #setTranslatesAutoresizingMaskIntoConstraints:, #sizeThatFits:, #sizeToFit, #systemLayoutSizeFittingSize:, transitionFromView:toView:duration:options:completion:, transitionWithView:duration:options:animations:completion:, #translatesAutoresizingMaskIntoConstraints, #updateConstraints, #updateConstraintsIfNeeded, #viewForBaselineLayout, #viewPrintFormatter, #viewWithTag:, #willMoveToSuperview:, #willMoveToWindow:, #willRemoveSubview:
Methods inherited from UIResponder
#becomeFirstResponder, #canBecomeFirstResponder, #canPerformAction:withSender:, #canResignFirstResponder, #isFirstResponder, #motionBegan:withEvent:, #motionCancelled:withEvent:, #motionEnded:withEvent:, #nextResponder, #reloadInputViews, #remoteControlReceivedWithEvent:, #resignFirstResponder, #touchesBegan:withEvent:, #touchesCancelled:withEvent:, #touchesEnded:withEvent:, #touchesMoved:withEvent:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (UIControlContentHorizontalAlignment) contentHorizontalAlignment
The horizontal alignment of content (text or image) within the receiver. The value of this property is a constant that specifies the alignment of text or image within the receiver. The default is UIControlContentHorizontalAlignmentLeft.
- (UIControlContentVerticalAlignment) contentVerticalAlignment
The vertical alignment of content (text or image) within the receiver. This value of this property is a constant that specifies the alignment of text or image within the receiver. The default is UIControlContentVerticalAlignmentTop.
- (Boolean) enabled
A Boolean value that determines whether the receiver is enabled. Specify YES to make the control enabled; otherwise, specify NO to make it disabled. The default value is YES. If the enabled state is NO, the control ignores touch events and subclasses may draw differently.
- (Boolean) highlighted
A Boolean value that determines whether the receiver is highlighted. Specify YES if the control is highlighted; otherwise NO. By default, a control is not highlighted. UIControl automatically sets and clears this state automatically when a touch enters and exits during tracking and when there is a touch up.
- (Boolean) selected
A Boolean value that determines the receiver’s selected state. Specify YES if the control is selected; otherwise NO. The default is NO. For many controls, this state has no effect on behavior or appearance. But other subclasses (for example, UISwitchControl) or the application object might read or set this control state.
- (UIControlState) state (readonly)
A Boolean value that indicates the state of the receiver. (read-only) One or more UIControlState bit-mask constants that specify the state of the UIControl object; for information on these constants, see “Control State.” Note that the control can be in more than one state, for example, both disabled and selected (UIControlStateDisabled | UIControlStateSelected).This attribute is read only—there is no corresponding setter method.
- (Boolean) touchInside (readonly)
A Boolean value that indicates whether a touch is inside the bounds of the receiver. (read-only) The value is YES if a touch is inside the receiver’s bounds; otherwise the value is NO.
- (Boolean) tracking (readonly)
A Boolean value that indicates whether the receiver is currently tracking touches related to an event. (read-only) The value is YES if the receiver is tracking touches; otherwiseNO.
Instance Method Details
- (Array) actionsForTarget(target, forControlEvent:controlEvent)
Returns the actions that are associated with a target and a particular control event. Pass in a selector name to the NSSelectorFromString function to obtain the selector (SEL) value.
- (Object) addTarget(target, action:action, forControlEvents:controlEvents)
Adds a target and action for a particular event (or events) to an internal dispatch table. You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. The action message may optionally include the sender and the event as parameters, in that order.When you call this method, target is not retained.
- (UIControlEvents) allControlEvents
Returns all control events associated with the receiver.
- (NSSet) allTargets
Returns all target objects associated with the receiver.
- (Boolean) beginTrackingWithTouch(touch, withEvent:event)
Sent to the control when a touch related to the given event enters the control’s bounds.
- (Object) cancelTrackingWithEvent(event)
Tells the control to cancel tracking related to the given event.
- (Boolean) continueTrackingWithTouch(touch, withEvent:event)
Sent continuously to the control as it tracks a touch related to the given event within the control’s bounds.
- (Object) endTrackingWithTouch(touch, withEvent:event)
Sent to the control when the last touch for the given event completely ends, telling it to stop tracking.
- (Object) removeTarget(target, action:action, forControlEvents:controlEvents)
Removes a target and action for a particular event (or events) from an internal dispatch table.
- (Object) sendAction(action, to:target, forEvent:event)
In response to a given event, forwards an action message to the application object for dispatching to a target. UIControl implements this method to forward an action message to the singleton UIApplication object (in its sendAction:to:fromSender:forEvent: method) for dispatching it to the target or, if there is no specified target, to the first object in the responder chain that is willing to handle it. Subclasses may override this method to observe or modify action-forwarding behavior. The implementation of sendActionsForControlEvents: might call this method repeatedly, once for each specified control event.
- (Object) sendActionsForControlEvents(controlEvents)
Sends action messages for the given control events. UIControl implements this method to send all action messages associated with controlEvents, repeatedly invoking sendAction:to:forEvent: in the process. The list of targets and actions it looks up is constructed from prior invocations of addTarget:action:forControlEvents:.