In the implementation of network asynchronous storage, suddenly found that the control Uiimageview A little rusty, here to review a bit.
Uiimageview, As the name implies is used to place the image.
1. Initialize uiimageview
Uiimageview *imgshadow = [[uiimageview alloc] initwithframe:cgrectmake ( A. )];
[Imgshadow setimage:[UIImage imagenamed:@ "9.jpg"];
[Self. View addsubview:Imgshadow];
2. ForUiimageviewAdd Effect
// set border color
[Imgshadow. layer setBorderColor: [[uicolor whitecolor] Cgcolor];
Set Border Width
[ Imgshadow. layer 1.0];
// Set the projection offset, cgsizemake (X axis direction, Y axis direction)
[[Imgshadow layer] setshadowoffset: Cgsizemake(1, 1)];
set the projection color
[[Imgshadow layer] setshadowcolor: [uicolor Redcolor]. Cgcolor];
set the projection radius
[[Imgshadow layer] Setshadowradius:3];
Set Transparency
[[Imgshadow layer] setshadowopacity:1];
When set toYes, beyond the bounds will be obscured(hidden ), often with Cornerradius, attributes used. This way, the area outside the fillet will be obscured
[Imgshadow. Layer setmaskstobounds:YES];
Set rounded corners
Imgshadow. layer. Cornerradius = ten;
3. Change location
Change the location of a uiimageview, you can
3.1 Modify its Frame property directly
3.2 Modify its Center property:
Imageview.center = Cgpointmake (CGFloat x, cgfloat y);
The Center property refers to the middle point of the ImageView.
3.3 Using the Transform property
Imageview.transform = cgaffinetransformmaketranslation (cgfloat dx, cgfloat dy);
where dx and dy indicate how much you want to move in the X or Y direction, rather than how much to move.
4. Rotate the image
Imageview.transform = cgaffinetransformmakerotation (cgfloat angle);
Note that it rotates in a clockwise direction, and the center of the rotation is the center of the original ImageView, which is the position represented by the Center property.
The parameter of this method is angle in radians, not our most commonly used degree, so you can write a macro definition:
#define Degreestoradians (x) (m_pi* (x)/180.0)
Small write incomplete, if there is omission, please contact!!!
UI Control (iOS)---uiimageview