First, UIView Common Properties
1.Frame position and size (in the upper-left corner of the parent control is the origin (0,0))
2.Center midpoint (in the upper-left corner of the parent control is the origin (0,0))
3.bounds position and size (in its own upper left corner as the origin (0,0))
4.transform Deformation properties (scaling, rotation)
5.backgroundColor Background Color
6.Tag ID (the parent control can find the corresponding child control based on this identity, not the same child control in the same parent control tag)
7.hidden setting whether to hide
8.alpha Transparency (0~1)
9.opaque opacity (0~1)
10.userInteractionEnabled can interact with the user (YES can interact)
11.superview Parent Control
12.subviews child controls
mode of 13.contentMode content display
Ii. Common methods of UIView
1.addSubview:
Add child controls, added to top (last Face in Subviews)
2.removeFromSuperview
Remove from parent control
3.viewWithTag:
The parent control can find the corresponding child control (traversing all child controls) based on the tag identity
4.insertsubview:atindex:
Add a child control to a specified location
5. Performing animations using two-class methods
+ (void) Beginanimations: (NSString *) Animationid context: (void *) context;
/* ... code to perform the animation: */
+ (void) commitanimations;
6. performing animations with block
/*
Duration Animation Duration
Animations Store the code that needs to execute the animation
Completion the action code to be executed after the animation is stored
*/
+ (void) Animatewithduration: (nstimeinterval) Duration animations: (void (^) (void )) Animations completion: (void (^) (BOOL finished)) Completion
Third, Uicontrol
1. As long as you inherit the Uicontrol, you can easily handle some events (click events, Value change events)
2. inherits the subclass of the Uicontrol:
UIButton, UISlider, Uiswitch, Uidatepicker, etc.
3. When you need to listen for a child control event, resolve the steps:
1> First See if it inherits from Uicontrol
2> See if it has a delegate property inside it .
4. Common Properties
1> enabled can handle events similar to UIView 's userinteractionenabled properties
2> How the contents of Contentverticalalignment are arranged in the vertical direction
3> How the contents of Contenthorizontalalignment are arranged in the horizontal direction
5. Common methods
1> Add Listener
/*
Target Listener Object
The method that is called when the action event fires, and the method that invokes the target
ControlEvents Event Type
*/
-(void) AddTarget: (ID) Target action: (SEL) Action forcontrolevents: ( uicontrolevents) controlevents;
2> Delete listener
When the listener is deleted, the listener is no longer notified when the event fires, and the Target's action method is no longer called.
-(void) Removetarget: (ID) Target action: (SEL) Action forcontrolevents: ( uicontrolevents) controlevents;
3> Get all Listener Objects
-(Nsset *) alltargets;
Iv. Common Properties of UILabel
1.text content displayed by text
2.textColor text color
3.font Fonts
shadow Color of 4.shadowColor text
5.deviation distance of Shadowoffset shadow (width horizontal deviation distance, positive right,height vertical deviation distance, positive bottom)
6.TextAlignment Set the arrangement of text (left, right, center)
7.numberoflines allow text to be up to a few lines (default is 1, if 0, wrap)
Wu, UIButton
1. Common Properties
1> Titlelabel Gets the internal Uilabel object
2> ImageView Gets the internal Uiimageview object
2. Common methods
1> Set the text content of the internal Uilabel display
when setting the button text, do not btn.titleLabel.text = @ "4324324";
-(void) Settitle: (NSString *) title forstate: (uicontrolstate) state;
2> Set The text color of the internal Uilabel
-(void) Settitlecolor: (Uicolor *) color forstate: (uicontrolstate) state;
3> Set text shadow color for internal Uilabel
-(void) Settitleshadowcolor: (Uicolor *) color forstate: (uicontrolstate) state;
4> setting a picture of an internal Uiimageview
The picture of the internal Uiimageview cannot be set: Btn.imageView.image = [UIImage imagedname:@ "0.png"];
-(void) SetImage: (UIImage *) image forstate: (uicontrolstate) state;
5> Set background image
-(void) SetBackgroundImage: (UIImage *) image forstate: (uicontrolstate) state;
6> The following two methods need to be overridden by subclasses and then used to re-layout the button.
returns the frame(position and size) of the internal Uilabel
-(CGRect) Titlerectforcontentrect: (CGRect) Contentrect;
returns the frame(position and size) of the internal Uiimageview
-(CGRect) Imagerectforcontentrect: (CGRect) Contentrect;
7> The following methods can get some property values in different States
-(NSString *) Titleforstate: (uicontrolstate) state;
-(Uicolor *) Titlecolorforstate: (uicontrolstate) state;
-(Uicolor *) Titleshadowcolorforstate: (uicontrolstate) state;
-(UIImage *) Imageforstate: (uicontrolstate) state;
-(UIImage *) Backgroundimageforstate: (uicontrolstate) state;