UIview Learning and Customizing--ios

Source: Internet
Author: User

        UIView *view1=[[uiview Alloc] Initwithframe:cgrectmake (50, 50, 100, 100)];    View1.backgroundcolor=[uicolor Yellowcolor];    view1.tag=1;        [Self.window Addsubview:view1];    UIView *view2=[[uiview Alloc] Initwithframe:cgrectmake (10, 10, 20, 20)];    View2.backgroundcolor=[uicolor Greencolor];    view2.tag=2; view2.alpha=0.2;//change the transparency will affect the child view display [View1 addsubview:view2];//view nesting UIView *view3=[[uiview alloc] Initwithframe:cg    Rectmake (10, 10, 30, 30)];    View3.backgroundcolor=[uicolor Graycolor];    view3.tag=3;    [View2 addsubview:view3];//view 3 colors affected by the parent class UIView *view5=[[uiview Alloc] Initwithframe:cgrectmake (50, 50, 30, 30)];    View5.backgroundcolor=[uicolor Graycolor];    view5.tag=5;        [View1 ADDSUBVIEW:VIEW5];    UIView *view4=[[uiview alloc] Initwithframe:cgrectmake (0, 0, 50, 50)];    View4.backgroundcolor=[uicolor Blackcolor];        view4.hidden=yes;//hides the view, also affects the sub-class [View1 ADDSUBVIEW:VIEW4]; UIView *view6=[[uiview Alloc] Initwithframe:cgrectmakE (80, 80, 10, 10)];        View6.backgroundcolor=[uicolor colorwithred:1 green:0 blue:0 alpha:0.5];//[View1 addsubview:view6];        UIView *view=[self.window viewwithtag:2];//Get the specified view via tag View.backgroundcolor=[uicolor Redcolor];    Custom View MyView *myview=[[myview alloc] Initwithframe:cgrectmake (150, 150, 100, 100)];        [Self.window Addsubview:myview]; [Self.window makekeyandvisible];

UIview Learning and Customizing--ios

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.