In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to delete the blank view of the iOS11 application view in iOS11 development. I hope you will get something after reading this article. Let's discuss it together.
When the developer no longer needs a view of the main view, it can be deleted. To do this, you need to use the removeFromSuperview () method, which has the following syntax:
The name of the view object to delete .removeFromSuperview ()
[example 1-3] the following code adds two views to the main view, and then deletes one of them using the removeFromSuperview () method. The code is as follows:
Import UIKit
Class ViewController: UIViewController {
Override func viewDidLoad () {
Super.viewDidLoad ()
/ / Do any additional setup after loading the view, typically from a nib.
/ / add blank view newView1
Let newView1=UIView (frame: CGRect (x: 0, y: 75, width: 375, height: 232))
NewView1.backgroundColor=UIColor.cyan
Self.view.addSubview (newView1)
/ / add blank view newView2
Let newView2=UIView (frame: CGRect (x: 0,352, width: 375, height: 232)
NewView2.backgroundColor=UIColor.orange
Self.view.addSubview (newView2)
}
……
}
When you run the program at this point, you will see the effect shown in figure 1.54. If you want to delete the view object newView1, you need to use the removeFromSuperview () method, as follows:
NewView1.removeFromSuperview () / / Delete the view object newView1
The running effect is shown in figure 1.55.
Figure 1.54 running effect figure 1.55 running effect
After reading this article, I believe you have a certain understanding of "how to delete the blank view of the iOS11 application view in iOS11 development". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.