IOS10 UI Tutorial View and child view visibility

Source: Internet
Author: User

iOS10 UI Tutorial View and child view visibility

iOS10 UI Tutorial views and the visibility of child views, A parent view can define the visibility of a child view beyond the bounds (the boundary is the frame of the parent view, which is the extent that the parent view can display) through the Clipstobounds property. Its grammatical form is as follows:

var clipstobounds:bool {Get Set}

Where this property is set to True, the view masks its child views, preventing those child views from appearing outside the boundary, as shown in 1.17.

Figure 1.17 Visibility

Example 1-8:clipstobounds the following will use the Clipstobounds property to make the child view in Cyan view not appear outside the bounds. The following steps are described:

(1) Open the Main.storyboard file and design the main view, as shown in effect 1.18.

The views that need to be added and the settings for them are shown in table 1-2.

Table 1-2 settings for a View object

Figure 1.18 Effect of the main view

Note: Orange view is a child view of Cyan view, and Green is a child view of Orange view.

When you run the program, you see the effect shown in 1.19.

(2) Open the Viewcontroller.swift file, write code, realize the function of clipping boundary. The code is as follows:

Import Uikitclass Viewcontroller:uiviewcontroller {    @IBOutlet weak var view1:uiview!    Override Func Viewdidload () {        super.viewdidload ()        //Do any additional setup after loading the view, typically fro M a nib.        View1.clipstobounds=true    } ...}

When you run the program, you see the effect shown in 1.20.

Figure 1.19 Run effect figure 1.20 Run effect

IOS10 UI Tutorial View and child view visibility

related reading:iOS10 UI Tutorial Managing hierarchies

IOS10 UI Tutorial View and child view visibility

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.