UIView attribute: The layer attribute of uiview

Source: Internet
Author: User
Tags print format

UIView attribute: The layer attribute of uiview
UIView attributes

AutoresizingMask

Automatically adjusts the middle position of the Child control and the parent control, width and height.

UIViewAutoresizingNone is not automatically adjusted.

UIViewAutoresizingFlexibleLeftMargin automatically adjusts the distance from the left side of superView to ensure that the distance from the right side of superView remains unchanged.

UIViewAutoresizingFlexibleRightMargin automatically adjusts the right distance from the superView to ensure that the left distance from the superView remains unchanged.

UIViewAutoresizingFlexibleTopMargin automatically adjusts the distance from the superView top to ensure that the distance from the superView bottom remains unchanged.

UIViewAutoresizingFlexibleBottomMargin automatically adjusts the distance from the superView bottom, that is, the distance from the superView top remains unchanged.

UIViewAutoresizingFlexibleWidth automatically adjusts its width to ensure the distance from the left and right sides of superView.

UIViewAutoresizingFlexibleHeight automatically adjusts its height to ensure the distance from the top and bottom of the superView.

AutoresizesSubviews

If the autoresizesSubviews attribute declaration is set to YES, its child views are automatically adjusted based on the autoresizingMask attribute value. Simply configuring the automatic size adjustment mask of the view can often make the application get the appropriate behavior; otherwise, the application must provide its own implementation by reloading the layoutSubviews method.

SizeThatFits

The size calculated and returned is the most suitable for its subview view. (Make the view calculation best suited to the size of the subview, that is, to display all the subviews to the minimum size required)

SizeToFit

Obtain the size that is most suitable for the current sub-view. (adjust the view based on the size and position of the sub-view so that it fits around the sub-view, that is, it automatically adapts to the size of the sub-view, show only subviews)

Frame

In the parent view location (reference point: parent view Coordinate System)

Bounds

Position and size of the view in the local coordinate system (reference point: Local Coordinate System)

Center

Center point in the frame (determines whether the current view is the only object for processing touch events)

Small attribute

Hidden View

Alpha transparency (0 ~ 1)

Opaque opacity (0 ~ 1)

UserInteractionEnabled Interaction

MultipleTouchEnabled supports multi-touch

ExclusiveTouch determines whether the current view processes the unique object of the outbound event.

ClearsContextBeforeDrawing

Determine whether to clear the previous content of the view before repainting the view. The default value is YES. If you set this attribute to NO, ensure that the painting is correct in the drawRect: method. If your code has been greatly optimized, setting it to NO can improve the performance, especially when scrolling, you may only need to repaint part of the view.

ClipsToBounds

Determines whether the subview is restricted to the bounds of the current view. The default value is NO.

ContentScaleFactor

Proportional Scale applied to the current view

GestureRecognizers

Gesture identifiers attached to the current view

Layer

Core animation layer for view rendering

MotionEffects

The motion effect of the current view (the motion effect of the current view is available only after IOS7)

RestorationIdentifier

This identifier determines whether the view supports restoration. In fact, it is only a identifier. In my opinion, it is equivalent to the identifier used When configuring each cell in the table view. It can be reused directly in the memory, this identifier should not be defined simply because its view controller and all its parent view controllers must have a recovery identifier.

Basic

Subviews all subviews of the current view

Superview parent view of the current view

Tag current view tag

TintAdjustmentMode tone adjustment mode, which is used for iOS7

Transform view Affine Transformation

UserInteractionEnabled determines whether the interaction event with the user is removed from the ignored event queue.

UIWindow in the current view of windows

UIViewContentModel

UIViewContentModeScaleToFill: scales the content to a proper proportion.

UIViewContentModeScaleAspectFit: scales the content to a proper size, and the extra parts of the boundary are transparent.

UIViewContentModeScaleAspectFill. The scaled content is filled with the specified size, and the excess part of the boundary is omitted.

UIViewContentModeRedraw: redraws the view Boundary

UIViewContentModeCenter: proportional scaling of views

UIViewContentModeTop, which is aligned at the top of the View

UIViewContentModeBottom: Align the bottom of the View

UIViewContentModeLeft, alignment on the left of the View

UIViewContentModeRight, alignment on the right of the View

UIViewContentModeTopLeft, alignment in the upper left corner of the View

UIViewContentModeTopRight: alignment in the upper right corner of the View

UIViewContentModeBottomLeft: alignment in the lower left corner of the View

UIViewContentModeBottomRight, which is aligned in the lower right corner of the View

Edit the editing status in the end/start view (generally used as the receiving keyboard)

(BOOL) endEditing :( BOOL) force

Response

-(Void) addGestureRecognizer :( UIGestureRecognizer *) gestureRecognizer adds a gesture reader for the view

-(Void) removeGestureRecognizer :( UIGestureRecognizer *) gestureRecognizer remove a gesture Reader

-(BOOL) gestureRecognizerShouldBegin :( UIGestureRecognizer *) gestureRecognizer starts a gesture Reader

-(Void) addMotionEffect :( UIMotionEffect *) When effect starts to add a motion effect to the view, it is actually vague. For example, the warning box will tilt with the phone tilt, of course, this requires code implementation, but we can now detect mobile phone motion events to respond accordingly-from iOS 7

Manage view levels

-(Void) addSubview :( UIView *) view to add a subview

-(Void) removeFromSuperview removed from parent View

-(Void) bringSubviewToFront :( UIView *) Move the specified subview to the top layer of the view.

-(Void) sendSubviewToBack :( UIView *) Move the created sub-view to the rear, under all sub-Views

-(Void) insertSubview :( UIView *) view atIndex :( NSInteger) insert the index into the subview at the specified position. All views of the view actually constitute an array.

-(Void) insertSubview :( UIView) View aboveSubview :( UIView) SiblingSubview: Move the specified subview to the front of the specified subview.

-(Void) insertSubview :( UIView) View belowSubview :( UIView) SiblingSubview: Move the specified subview to the end of the specified subview.

-(Void) exchangeSubviewAtIndex :( NSInteger) index1 withSubviewAtIndex :( NSInteger) index2 swap the positions of the two subviews

-(BOOL) isDescendantOfView :( UIView *) view determines whether the receiving object is a subview of the specified view, or the same view as the specified view

Opting in to Constraint-Based Layout)

-(Void) setTranslatesAutoresizingMaskIntoConstraints :( BOOL) flag sets whether the view automatically adjusts the size mask to a constraint based on the constraint layout.

-(BOOL) translatesAutoresizingMaskIntoConstraints determines whether the view converts the automatically adjusted size mask to a constraint based on the Constrained Layout.

Management constraints

-(NSArray *) constraints returns the constraints created by the view

-(Void) addConstraint :( NSLayoutConstraint *) constraint adds a constraint to the view layout or subview. The constraint can only be within the current view range, including the subview.

-(Void) addConstraints :( NSArray *) constraints adds a group of constraints

-(Void) removeConstraint :( NSLayoutConstraint *) Remove the specified constraint from the view.

-(Void) removeConstraints :( NSArray *) constraints remove a specified set of constraints

In the measurement Based on the Constraint Layout (Measuring in Constraint-Based Layout)

-(CGSize) systemLayoutSizeFittingSize :( CGSize) targetSize returns the size of the view that meets the constraints

-(CGSize) intrinsicContentSize: returns the original size of the recipient.

-(Void) invalidateIntrinsicContentSize: abolish the size of the original view content.

-(UILayoutPriority) contentCompressionResistancePriorityForAxis :( UILayoutConstraintAxis) axis sets whether the compression mode of the view is horizontal or vertical when the view is changed to an hour, and returns a priority

-(Void) setContentCompressionResistancePriority :( UILayoutPriority) priority forAxis :( UILayoutConstraintAxis) axis sets priority

-(UILayoutPriority) contentHuggingPriorityForAxis :( UILayoutConstraintAxis) the opposite of axis is how the view is enlarged and changed.

-(Void) setContentHuggingPriority :( UILayoutPriority) priority forAxis :( UILayoutConstraintAxis) axis

Aligning Views with Constraint-Based Layout)

-(CGRect) alignmentRectForFrame :( CGRect) the frame returns the alignment matrix of the view of the given frame.

-(CGRect) frameForAlignmentRect :( CGRect) alignmentRect returns the frame of the view with the given aligned rectangle

-(UIEdgeInsets) alignmentRectInsets returns the border of the alignmentRectInsets defined on the frame of the view.

-(UIView *) viewForBaselineLayout: returns a view that meets the baseline constraints.

Triggering Constraint-Based Layout)

-(BOOL) whether the constraints in the needsUpdateConstraints view need to be updated

-(Void) setNeedsUpdateConstraints: the constraints for setting the view must be updated.

-(Void) updateConstraints is the view update constraint.

-(Void) updateConstraintsIfNeeded: Constraints for updating views and their subviews

Debugging Constraint-Based Layout)

-(NSArray *) constraintsAffectingLayoutForAxis :( UILayoutConstraintAxis) axis returns constraints that affect the layout of a given axis view

-(BOOL) is the position of the hasAmbiguousLayout view not completely specified?

-(Void) exerciseAmbiguityInLayout: Use a fuzzy layout to randomly change the frame of the view among different valid values.

Drawing and Updating the View)

-(Void) drawRect :( CGRect) rect Painting View in the specified area

-(Void) setNeedsDisplay indicates that the boundary rectangle of the entire view needs to be re-painted.

-(Void) setNeedsDisplayInRect :( CGRect) the boundary of the view marked in the specified area by invalidRect needs to be re-painted

Format and print View content

-(UIViewPrintFormatter *) viewPrintFormatter returns the print format of the view.

-(Void) drawRect :( CGRect) area forViewPrintFormatter :( UIViewPrintFormatter *) formatter specifies the area and print the format of the Painting View content

Preserving and Restoring State)

-(Void) encodeRestorableStateWithCoder :( NSCoder *) status information of the coder encoding View

-(Void) decodeRestorableStateWithCoder :( NSCoder *) coder decodes a view status information

Converting Between View Coordinate Systems)

-(CGPoint) convertPoint :( CGPoint) point toView :( UIView *) view converts a point from the coordinate system of the accepted object to the specified view

-(CGPoint) convertPoint :( CGPoint) point fromView :( UIView *) view // opposite to the above, a point in the specified view coordinate is converted to the receiving object

-(CGRect) convertRect :( CGRect) rect toView :( UIView *) view

-(CGRect) convertRect :( CGRect) rect fromView :( UIView *) view refer to the above two methods

Click to test in the view

-(UIView) HitTest :( CGPoint) point withEvent :( UIEvent) Event click test specified event on the specified point

-(BOOL) pointInside :( CGPoint) point withEvent :( UIEvent *) test whether the specified vertex is included in the receiving object

Note the Changes associated with the View (Observing View-Related Changes)

-(Void) didAddSubview :( UIView *) subview Notification View indicates that the subview has been added

-(Void) willRemoveSubview :( UIView *) The subview Notification View will remove the specified subview.

-(Void) willMoveToSuperview :( UIView *) The newSuperview notification view will be moved to a new parent view.

-(Void) didMoveToSuperview the notification view has been moved to a new parent view.

-(Void) willMoveToWindow :( UIWindow *) The newWindow notification view will be moved to a new window.

-(Void) The didMoveToWindow notification view has been moved to a new window.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.