iOS Code library

Source: Internet
Author: User

1 /*Nine Gongge calculation*/2 intTotalcol =5;//Specify the total number of columns3 4CGFloat VIEWW = -;//Subview Width5CGFloat VIEWH = -;//Subview Height6 7CGFloat Marginx = (self.view.bounds.size.width-vieww*totalcol)/(totalcol+1);//Calculating horizontal gap gaps8CGFloat marginy = Marginx;//Calculating longitudinal white space gaps (and horizontal alignment)9 Ten  for(inti =0; i<self.applist.count; i++) {//traverse the View information in plist to generate Appview in view at once One      A     intcol = I%totalcol;//calculate the column where the Appview is located -     introw = I/totalcol;//calculate the row where the Appview is located -      theCGFloat x = col*vieww+ (col+1) *marginx;//Calculate the horizontal axis of a appview -CGFloat y = row*viewh+ (row+1) *marginy;//calculate the ordinate of a appview -      -UIView *appview =[[UIView alloc] Initwithframe:cgrectmake (x, Y, Vieww, VIEWH)]; +Appview.backgroundcolor = [Uicolor Redcolor];//Set Appview -      +[Self.view Addsubview:appview];//Add to view A } at  - /*Lazy Loading*/ --(Nsarray *) Applist - { - if(!applist) { -NSString *path = [[NSBundle mainbundle] Pathforresource:@"app"OfType:@"plist"]; inApplist = [Nsarray Arraywithcontentsoffile:path];//Load Plist Method -NSLog (@"%@", applist); to } + returnapplist; -}

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.