iOS Development-Control Contentmode Code change fill Pattern Summary

Source: Internet
Author: User

In the use of Uiimageview , It is sometimes necessary to set the fill mode of the contents of the picture in the code.

in order to facilitate the future work convenient to find use , the various models are now tested as follows


Test picture content fill mode static int a;-(void) test1{self.imageV.image = [UIImage imagenamed:@ "aa.jpg"];    Change the fill mode of internal content self.imageV.contentMode = A;    Display mode text UILabel *lab = [[UILabel alloc]initwithframe:cgrectmake (0, 300, 375, 100)]; Nsarray *arr = @[@ "Uiviewcontentmodescaletofill",//stretch adaptive fills the entire view @ "UIVIEWC                      Ontentmodescaleaspectfit ",//Adaptive proportional size display @" Uiviewcontentmodescaleaspectfill ",//Original size display @ "Uiviewcontentmoderedraw",//Redraw @ "Uiviewcontentmodecenter" when size changes,//           @ "Uiviewcontentmodetop",//Top @ "Uiviewcontentmodebottom", Bottom @ "Uiviewcontentmodeleft",//center sticker left @ "Uiviewcontentmoderight ",//center sticker Right @" Uiviewcontentmodetopleft ",//paste on top left @" Uiviewconte Ntmodetopright ",//Paste Right @ "uiviewcontentmodebottomleft",//paste left down @ "Uiviewcontentmodebottomright"    ,//paste right down];    Lab.text = arr[a++];    Lab.font = [Uifont systemfontofsize:20];    [Self.lab Removefromsuperview];    [Self.imagev Addsubview:lab];    Self.lab = Lab;    NSLog (@ "%s mode%d", __func__,a); if (a = =) A = 0;}




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

iOS Development-Control Contentmode Code change fill Pattern Summary

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.