Four easy-to-confuse attributes:
1. Textaligment: Alignment of the horizontal direction of the text
1> value
Nstextalignmentleft = 0,//left Justified
Nstextalignmentcenter = 1,//center alignment
Nstextalignmentright = 2,//Right Justified
2> which controls have this property: A control that is generally capable of displaying text has this property
* Uitextfield
* UILabel
* Uitextview
2. Contentverticalalignment: Vertical alignment of content
1> value
Uicontrolcontentverticalalignmentcenter = 0,//center alignment
Uicontrolcontentverticalalignmenttop = 1,//top aligned
Uicontrolcontentverticalalignmentbottom = 2,//Bottom alignment
2> which controls have this property: A control that inherits from Uicontrol or Uicontrol itself
* Uicontrol
* UIButton
* Uitextfield
* ...
3. Contenthorizontalalignment: Alignment of the horizontal orientation of the content
1> value
Uicontrolcontenthorizontalalignmentcenter = 0,//center alignment
Uicontrolcontenthorizontalalignmentleft = 1,//left Justified
Uicontrolcontenthorizontalalignmentright = 2,//Right Justified
2> which controls have this property: A control that inherits from Uicontrol or Uicontrol itself
* Uicontrol
* UIButton
* Uitextfield
* ...
4. Contentmode: Content Mode (controls the alignment of content), generally useful for uiimageview
1> value
/**
Law:
1.Scale: Picture will stretch
2.Aspect: Picture will maintain the original aspect ratio
*/
In the first 3 cases, the picture will stretch
(default) stretches the picture to fill the entire uiimageview (the picture will be displayed in the same size as the Uiimageview)
Uiviewcontentmodescaletofill,
Scale to fit the entire uiimageview (the image cannot exceed the Uiimageview size range) According to the original aspect ratio of the image.
Uiviewcontentmodescaleaspectfit,
Stretch to the width of the picture as the width of the uiimageview or the height of the image as the height of the Uiimageview, as the image's original aspect ratio is scaled.
Uiviewcontentmodescaleaspectfill,
All subsequent cases will be displayed in the original size of the image and will not be stretched
Uiviewcontentmoderedraw,//When the size of the control changes, it is redrawn once (call Setneedsdisplay again, call DrawRect:)
Uiviewcontentmodecenter,
Uiviewcontentmodetop,
Uiviewcontentmodebottom,
Uiviewcontentmodeleft,
Uiviewcontentmoderight,
Uiviewcontentmodetopleft,
Uiviewcontentmodetopright,
Uiviewcontentmodebottomleft,
Uiviewcontentmodebottomright,
2> which controls have this property: All UI controls have
5. If there are multiple properties that conflict, only 1 are valid (nearest principle)
[iOS Weibo project-1.3]-content alignment TextAlignment & verticalalignment & HorizontalAlignment & Contentmode