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