Suitable for all size printing mosaics

Source: Internet
Author: User

CGFloat width = +; CGFloat height= +; //Get screen width height//Get Screen ObjectUIScreen *screen =[UIScreen mainscreen]; //Get screen sizeCGRect Screenframe =[screen bounds]; //Take out the wide height of the screen individually//cgfloat screenwidth = screenFrame.size.width;CGFloat screenwidth =cgrectgetwidth (screenframe); //cgfloat screenheight = screenFrame.size.height;CGFloat screenheight =cgrectgetheight (screenframe);//x-Axis y-axis//Cgrectgetminx + cgrectgetminy = upper-left corner of view coordinates//cgrectgetmidx + cgrectgetmidy = Center coordinate of view//Cgrectgetmaxx + cgrectgetmaxy = upper-right corner of view coordinates//cgrectgetwidth + cgrectgetheight = size of view        /*( minx/y) (midx/0) (maxx,y) +-----.-----+ |     |     .     .   .           (Midx, Midy) |     | +-----.-----+     */            //calculate the number of each columnCGFloat col = screenwidth/width; //calculate the number of each rowCGFloat row = screenheight/height;  for(Nsinteger i =0; i < row; ++i) { for(Nsinteger j =0; J < Col; ++j) {UIView*v =[[UIView alloc] init]; //set line I, column J size of viewV.frame = CGRectMake (J * width, I *height, width, height); //Cgrectgetmidx (v.frame); //(v.frame.origin.x + v.frame.size.width)/2; //Cgrectgetmidy (v.frame); //(V.FRAME.ORIGIN.Y + v.frame.size.height)/2; //Set ColorV.backgroundcolor = [Uicolor colorwithred:arc4random ()% the/255.0Green:arc4random ()% the/255.0Blue:arc4random ()% the/255.0Alpha1]; //put it in the window display[Self.window addsubview:v]; }    }

Suitable for all size printing mosaics

Related Article

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.