Uiview's contentstretch (view extension and contraction)
There is not much information about contentstretch on the Internet. It took some time to study the official documents.
Make a record:
When 1.png is larger than imagev, 1.png is reduced.
When 1.png is smaller than imagev, 1.png is enlarged.
Zoom in:
Imagev. Image = [uiimage imagenamed: @ "1.png"];
[Imagev setcontentstretch: cgrectmake (150.0/300.0, 75.0/150.0, 10.0/300.0, 10.0/150.0)];
The size of 1.png is 210.0x126.0;
The frame of imagev is (9,117,300,150 );
150.0/300.0 indicates that the first 150 pixels are not stretched on the X axis.
75.0/150.0 indicates that on the Y axis, the first 75 pixels are not stretched.
10.0/x axis with 10 entries (151-160)walking, directly to 1.png filled with imagev.
10.0/150.0yaxis on the top of the 10 (76-85) feed stretch, straight to 1.png full imagev.
1. PNG (source image, which is readily available ....)
After stretching
Zoom out:
Imagev. Image = [uiimage imagenamed: @ "j.png"];
[Imagev setcontentstretch: cgrectmake (50.0/imagev. Frame. Size. Width,
50.0/imagev. Frame. Size. height,
(Imagev. Frame. Size. Width-100.0)/imagev. Frame. Size. Width,
(Imagev. Frame. Size. Height-100.0)/imagev. Frame. Size. Height)];
Source image
300x240 after compression
Imagev size: 200x150
From: http://hi.baidu.com/jt_one/blog/item/937b6e81932a58c3bc3e1e9b.html