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; -}