★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤微信公众号:山青咏芝(let_us_code)
➤博客园地址:山青咏芝(https://www.cnblogs.com/strengthen/)
➤GitHub地址:https://github.com/strengthen/LeetCode
➤原文地址:https://www.cnblogs.com/strengthen/p/13239142.html
➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!支持原创!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
添加:
1 //获取delegate 2 let delegate = UIApplication.shared.delegate as! AppDelegate 3 //添加tag 4 searchView.tag = 9 5 //添加视图 6 delegate.window?.addSubview(searchView)
删除:
1 //获取delegate 2 let delegate = UIApplication.shared.delegate as! AppDelegate 3 //通过tag 从window移除视图 4 delegate.window?.viewWithTag(9)?.removeFromSuperview()