Class: MKOverlayPathView
- Inherits:
-
MKOverlayView
- Object
- NSObject
- UIResponder
- UIView
- MKOverlayView
- MKOverlayPathView
Overview
The MKOverlayPathView class represents a generic overlay that draws its contents using a CGPathRef data type. You can use this class to implement simple path-based overlay views or subclass it to define additional drawing behaviors. The default drawing behavior of this class is to apply the object’s current fill attributes, fill the path, apply the current stroke attributes, and then stroke the path.
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- fillColor
The fill color to use for the path.
-
- lineCap
The line cap style to apply to the open ends of the path.
-
- lineDashPattern
An array of numbers indicating the dash pattern for paths.
-
- lineDashPhase
The.
-
- lineJoin
The line join style to apply to corners of the path.
-
- lineWidth
The stroke width to use for the path.
-
- miterLimit
The limiting value that helps avoid spikes at junctions between connected line segments.
-
- path
The current path to use when drawing the overlay.
-
- strokeColor
The stroke color to use for the path.
Attributes inherited from MKOverlayView
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)
-
- applyFillPropertiesToContext:atZoomScale:
Applies the receiver’s current fill-related drawing properties to the specified graphics context This is a convenience method for applying all of the drawing properties used when filling a path.
-
- applyStrokePropertiesToContext:atZoomScale:
Applies the receiver’s current stroke-related drawing properties to the specified graphics context.
-
- createPath
Creates the path for the overlay.
-
- fillPath:inContext:
Fills the area enclosed by the specified path.
-
- invalidatePath
Releases the path associated with the receiver.
-
- strokePath:inContext:
Draws a line along the specified path.
Methods inherited from MKOverlayView
#canDrawMapRect:zoomScale:, #drawMapRect:zoomScale:inContext:, #initWithOverlay:, #mapPointForPoint:, #mapRectForRect:, #pointForMapPoint:, #rectForMapRect:, #setNeedsDisplayInMapRect:, #setNeedsDisplayInMapRect:zoomScale:
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
- (UIColor) fillColor
The fill color to use for the path.
- (CGLineCap) lineCap
The line cap style to apply to the open ends of the path. The line cap style is applied to the start and end points of any open subpaths. This property does not affect closed subpaths. The default line cap style is kCGLineCapButt.
- (Array) lineDashPattern
An array of numbers indicating the dash pattern for paths. The array contains one or more NSNumber objects that indicate the lengths (measured in points) of the line segments and gaps in the pattern. The values in the array alternate, starting with the first line segment length, followed by the first gap length, followed by the second line segment length, and so on.This property is set to nil by default, which indicates no line dash pattern.
- (Float) lineDashPhase
The
- (CGLineJoin) lineJoin
The line join style to apply to corners of the path. The default line join style is kCGLineJoinMiter.
- (Float) lineWidth
The stroke width to use for the path. The default value of this property is 0.
- (Float) miterLimit
The limiting value that helps avoid spikes at junctions between connected line segments. The miter limit helps you avoid spikes in paths that use the kCGLineJoinMiter join style. If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit, the joint is converted to a bevel join. The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees.
- (CGPathRef) path
The current path to use when drawing the overlay. Getting the value of this property causes the path to be created (using the createPath method) if it does not already exist. You can also assign a path object to this property explicitly.When assigning a new path object to this property, the receiver retains the path you specify.
- (UIColor) strokeColor
The stroke color to use for the path.
Instance Method Details
- (Object) applyFillPropertiesToContext(context, atZoomScale:zoomScale)
Applies the receiver’s current fill-related drawing properties to the specified graphics context This is a convenience method for applying all of the drawing properties used when filling a path. This method applies the current fill color to the specified graphics context.
- (Object) applyStrokePropertiesToContext(context, atZoomScale:zoomScale)
Applies the receiver’s current stroke-related drawing properties to the specified graphics context. This is a convenience method for applying all of the drawing properties used when stroking a path. This method applies the stroke color, line width, line join, line cap, miter limit, line dash phase, and line dash attributes to the specified graphics context. This method applies the scale factor in the zoomScale parameter to the line width and line dash pattern automatically so that lines scale appropriately.This method does not save the current graphics state before applying the new attributes. You must save it yourself and restore it later when you are done drawing.
- (Object) createPath
Creates the path for the overlay. The default implementation of this method does nothing. Subclasses should override it and use it to create the CGPathRef data type to be used for drawing. After creating the path, your implementation should then assign it to the path property.
- (Object) fillPath(path, inContext:context)
Fills the area enclosed by the specified path. You must set the current fill color before calling this method. Typically you do this by calling the applyFillPropertiesToContext:atZoomScale: method prior to drawing. If the fillColor property is currently nil, this method does nothing.
- (Object) invalidatePath
Releases the path associated with the receiver. You can call this method at any time where a change in the path information would require you to recreate the path. This method sets the path property to nil, which causes the cached path to be released.
- (Object) strokePath(path, inContext:context)
Draws a line along the specified path. You must set the current stroke color before calling this method. Typically you do this by calling the applyStrokePropertiesToContext:atZoomScale: method prior to drawing. If the strokeColor property is currently nil, this method does nothing.