swift - 如何在 Swift 4 中隐藏默认的 GSMapView InfoWindowOfMarker UIView 框架?
问题描述
我有一个我决定稍后使用的以编程方式创建的 UIView。但是,它现在在导航逻辑中被调用,我不想更改逻辑,因为我将在第二个版本中介绍此预览版。问题是我被一个默认框架卡住了,我无法移动到屏幕之外或将大小更改为零或隐藏。
这是代码中的类,我附上了这个丑陋的白色默认框架的图片,我需要以某种方式隐藏。我尝试了很多带有约束、透明度等的选项,但它仍然存在。有人可以给建议吗?
class PointPreview: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
}
}
解决方案
您是否尝试过将另一个视图(看起来像从您的图像中猜测的地图)放在白色视图前面?
你可以这样做:
class ViewController: UIViewController{
override func viewDidLoad() {
let pointPreview = PointPreview()
let otherView = UIView()
self.view.addSubview(otherView)
self.view.addSubview(pointPreview)
self.view.bringSubviewToFront(otherView) //this makes the otherView(map) go in front of the pointPreview
}
}
推荐阅读
- node.js - 节点检查器不会在断点处停止
- python - 用 NaN 替换熊猫系列中连续零的负值和“块”直到第一个正值
- plsql - 收到警告:创建的函数存在编译错误
- javascript - jQuery Datatables:将列可见性与单个列过滤器(文本输入)结合起来?
- javascript - 如何在反应应用程序中动态添加文件输入
- java - 在 Linux 上运行时,Spring-boot jar 返回 whitelabel 错误
- docker - 无法使用 Jenkinsfile 在注册表上推送 docker 映像
- vbscript - 如何将日期时间输出重新格式化为 ISO 8601
- html - 无法水平对齐列表和视频
- android - constraintlayout.widget.Group 动画不适用于 TransitionManager