IOS Uiviewcontentmode Detailed

Source: Internet
Author: User

Uiviewcontentmode Yes UIView Uiimageview , UIView , UILabel Span style= "line-height:normal; font-family: "pingfang sc" "", UIButton set contentmode property to see the effect.

Through the test you can see that contentmode uiimageview function, for UIView UILabel UIButton

for uiview because its child view has already set its own frame , the position is fixed, so here contentmode The does not work.

for UILabel , UIButton , and did not, as expected, by setting a different Contentmode , while changing UILabel , UIButton The fill style for Chinese text or picture content.

So, for Contentmode The main exploration of the property is placed in the Uiimageview on.

Let's take a look at all the tests you get:

typedef Ns_enum (Nsinteger, Uiviewcontentmode) {

// default style picture fills the entire outline, does not zoom in or out proportionally, the picture may deform

Uiviewcontentmodescaletofill,

// picture is scaled up or down until the side lengths of the picture and contour are the same, and the picture must stretch but not deform

Uiviewcontentmodescaleaspectfit,

// picture is scaled up or down until the side lengths of the picture and contour are the same, and the picture must stretch but not deform

Uiviewcontentmodescaleaspectfill,

// when calling the setneedsdisplay method, the picture will be re-rendered, the following operation, the picture will not be stretched, not deformed

Uiviewcontentmoderedraw,

Uiviewcontentmodecenter,

Uiviewcontentmodetop,

Uiviewcontentmodebottom,

Uiviewcontentmodeleft,

Uiviewcontentmoderight,

Uiviewcontentmodetopleft,

Uiviewcontentmodetopright,

Uiviewcontentmodebottomleft,

Uiviewcontentmodebottomright,

};

Welcome to the great gods feel free, correct ~

IOS Uiviewcontentmode Detailed

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.