iOS Development View View

Source: Internet
Author: User

Initializing a view Object//Initialize View

-(ID) initWithFrame: (cgrect) Arect//initialized with a rectangle object

Configuring a View ' s visual appearance//configure visual display

@property (nonatomic, copy) Uicolor *backgroundcolor//Set background color
@property (nonatomic, Getter=ishidden) BOOL hidden//Hide view, default to No
@property (nonatomic) cgfloat Alpha//Set transparency, 0.0 to 1.0 bands
@property (nonatomic, Getter=isopaque) BOOL opaque//Tell the system renderer whether the view is opaque, set Yes to speed up rendering, default to Yes, set to No if alpha value is set
@property (nonatomic) BOOL clipstobounds//whether to crop out-of-bounds views, similar to overflow in CSS, default to No
@property (nonatomic) BOOL clearscontextbeforedrawing//whether to clear the contents of the buffer is not visible, the default is yes, if in a scrolling operation of the view, should be set to no, to avoid re-rendering, improve performance
+ (Class) Layerclass//can return the class used by the primary layer, UIView subclasses can overload this method to let UIView use different calayer to display
@property (Nonatomic, ReadOnly, retain) Calayer *layer//Return to the rendering method used by the core animation layer

Configuring the event-related Behavior//Configure event relationships

@property (nonatomic, getter=isuserinteractionenabled) BOOL userinteractionenabled//Set view to respond to user events such as touch, keyboard , the default is Yes
@property (nonatomic, getter=ismultipletouchenabled) BOOL multipletouchenabled//Set view to respond to multi-touch, default to No
@property (nonatomic, Getter=isexclusivetouch) BOOL Exclusivetouch//Set touch whether to rank it, default to No

Configuring the Bounds and frame rectangles//configure boundaries and rectangular frames

@property (nonatomic) CGRect frame//Set view frame
@property (nonatomic) cgrect bounds//Set view boundary
@property (nonatomic) Cgpoint Center//Set Central point
@property (nonatomic) Cgaffinetransform Transform//Set transform, similar to CSS, Cgaffinetransform is a matrix structure

Managing the View Hierarchy//Manage views level

@property (nonatomic, readonly) UIView *superview//Return to Parent view, read-only
@property (nonatomic, readonly, copy) Nsarray *subviews//Return child view collection, read-only
@property (nonatomic, readonly) UIWindow *window//Return window object, read-only
-(void) Addsubview: (UIView *) View//Add a sub view to view
-(void) Bringsubviewtofront: (UIView *) View//Move a sub-view position to the top of the list
-(void) Sendsubviewtoback: (UIView *) View//Move one sub-view position one cell backward
-(void) Removefromsuperview//Remove the view that invokes the method from its parent view
-(void) Insertsubview: (UIView *) View Atindex: (nsinteger) index//Insert a child view to the specified index, starting with 0
-(void) Insertsubview: (UIView *) View Abovesubview: (UIView *) Siblingsubview//Insert a child view before the specified view
-(void) Insertsubview: (UIView *) View Belowsubview: (UIView *) Siblingsubview//Insert a child view after the specified view
-(void) Exchangesubviewatindex: (Nsinteger) index1 Withsubviewatindex: (nsinteger) INDEX2//Exchange two view index
-(BOOL) Isdescendantofview: (UIView *) View//Determine whether the child node of the specified element or itself

Configuring the resizing Behavior//Configuration size change behavior

@property (nonatomic) uiviewautoresizing autoresizingmask//How child nodes adapt to changes when the parent element's window size changes
@property (nonatomic) BOOL autoresizessubviews//Sub-view adaptive change, default Yes
@property (nonatomic) uiviewcontentmode contentmode//view Adaptive Change Mode
-(Cgsize) Sizethatfits: (cgsize) size//Pass view dimension, return suggested sub view size
-(void) SizeToFit//Adjust the size of the view to fit its contents

Laying out subviews//Layout child node

-(void) Layoutsubviews//Layout sub View
-(void) setneedslayout//Refresh the layout in the next update
-(void) layoutifneeded//Refresh layout now

Opting in to constraint-based layout//How to select constrained layouts

+ (BOOL) Requiresconstraintbasedlayout//Returns whether the view is a constrained layout mode, IOS6
-(BOOL) translatesautoresizingmaskintoconstraints//Returns a BOOL to determine whether the automatic layout can be used for the transition constraint layout, IOS6
-(void) Settranslatesautoresizingmaskintoconstraints: (BOOL) flag//sets whether the automatic layout is converted to constrained layout in the constrained layout system, IOS6

Managing Constraints//Constraint management

-(Nsarray *) constraints//Return to the view's constraint handle, IOS6
-(void) AddConstraint: (Nslayoutconstraint *) constraint//Add constraint handle, IOS6
-(void) Addconstraints: (Nsarray *) constraints//Adding an array of constraint handles, IOS6
-(void) Removeconstraint: (Nslayoutconstraint *) constraint//delete constraint handle, IOS6
-(void) Removeconstraints: (Nsarray *) constraints//delete constraint handle array, IOS6

Measuring in constraint-based layout//measuring constrained layouts

-(Cgsize) Systemlayoutsizefittingsize: (cgsize) targetsize//Return to the most suitable size, IOS6
-(Cgsize) intrinsiccontentsize//Return to the natural dimensions of the view, IOS6
-(void) invalidateintrinsiccontentsize//Invalidates the content size, IOS6
-(Uilayoutpriority) Contentcompressionresistancepriorityforaxis: (uilayoutconstraintaxis) axis//To be added, IOS6
-(void) Setcontentcompressionresistancepriority: (uilayoutpriority) Priority foraxis: (uilayoutconstraintaxis) axis/ /To be added, IOS6
-(Uilayoutpriority) Contenthuggingpriorityforaxis: (uilayoutconstraintaxis) axis//To be added, IOS6
-(void) Setcontenthuggingpriority: (uilayoutpriority) Priority foraxis: (uilayoutconstraintaxis) axis//To be added, IOS6

Aligning views with constraint-based layout//Calibration constraint layouts

-(CGRect) Alignmentrectforframe: (CGRect) frame//To be added, IOS6
-(CGRect) Frameforalignmentrect: (cgrect) Alignmentrect//To be added, IOS6
-(Uiedgeinsets) alignmentrectinsets//To be added, IOS6
-(UIView *) viewforbaselinelayout//To be added, IOS6

Triggering constraint-based layout//triggering constrained layouts

-(BOOL) needsupdateconstraints//Returns whether the constraint layout needs to be updated, yes Yes, IOS6
-(void) setneedsupdateconstraints//update constrained layout, IOS6
-(void) updateconstraints//update constrained layout, IOS6
-(void) updateconstraintsifneeded//update constrained layout and its sub-layout, IOS6

Debugging constraint-based Layout//debug constrained layouts

-(Nsarray *) Constraintsaffectinglayoutforaxis: (uilayoutconstraintaxis) axis//To be added, IOS6
-(BOOL) hasambiguouslayout//To be supplemented, IOS6
-(void) exerciseambiguityinlayout//To be added, IOS6

Drawing and Updating The View//drawing and updating views

-(void) DrawRect: (cgrect) rect//Draw a rectangle in view
-(void) Setneedsdisplay//Make view redraw
-(void) Setneedsdisplayinrect: (cgrect) invalidrect//Specify rectangle Redraw
@property (nonatomic) cgfloat contentscalefactor//To be added

Formatting printed View content//formatting contents

-(Uiviewprintformatter *) Viewprintformatter//Return to view of the Print object
-(void) DrawRect: (cgrect) area forviewprintformatter: (Uiviewprintformatter *) formatter//use a region to print

Managing Gesture recognizers//Manage gestures

-(void) Addgesturerecognizer: (Uigesturerecognizer *) Gesturerecognizer//Add gesture recognizer
-(void) Removegesturerecognizer: (Uigesturerecognizer *) Gesturerecognizer//delete gesture recognizer
@property (nonatomic, copy) Nsarray *gesturerecognizers//Get Gesture Collection
-(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) Gesturerecognizer//Determines whether this gesture is recognized by the return value

Animating view with Blocks//make multiple views perform animations

+ (void) Animatewithduration: (nstimeinterval) Duration delay: (nstimeinterval) Delay options: (uiviewanimationoptions) Options animations: (void (^) (void)) animations completion: (void (^) (BOOL finished)) completion//make one or more view perform animations
+ (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void)) animations completion: (void (^) ( BOOL finished)) completion//make one or more view perform animations
+ (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void)) animations//make one or more view perform animations
+ (void) Transitionwithview: (UIView *) View Duration: (nstimeinterval) Duration options: (uiviewanimationoptions) Options animations: (void (^) (void)) animations completion: (void (^) (BOOL finished)) Completion//Create transition animation on a view
+ (void) Transitionfromview: (UIView *) Fromview Toview: (UIView *) Toview Duration: (nstimeinterval) Duration options: ( uiviewanimationoptions) Options Completion: (void (^) (BOOL finished)) Completion//

Animating views//view Animation

+ (void) Beginanimations: (NSString *) Animationid context: (void *) context//Flag Animation code Start

iOS Development View View

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.