IOS makes a. 9 stretch chart similar to Android

Source: Internet
Author: User
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

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.