我的应用中有一个 GMSMapView。带有开放地图屏幕的应用程序占用 150 mb 内存。
在某些时候,我添加了很多多边形。之后,应用程序需要 230 mb。
调用 [GMSMapView clear] 方法后,所有多边形都消失了,但应用程序仍占用 230 mb 的内存。
指向多边形的指针不会存储在其他任何地方。如何使地图清除内存以及为什么在调用“清除”方法后不会发生这种情况?
以下代码允许创建具有不同权重的字体。
func makeFont(weight: CGFloat, size: CGFloat) -> UIFont {
var attributesDict = [String: Any]()
attributesDict["Weight"] = weight
/* Rubik-Light - is a variable font */
let fontDescriptor = UIFontDescriptor(
fontAttributes: [
UIFontDescriptor.AttributeName.name : "Rubik-Light",
kCTFontVariationAttribute as UIFontDescriptor.AttributeName : attributesDict
]
)
return UIFont(descriptor: fontDescriptor, size: size)
}
Run Code Online (Sandbox Code Playgroud)
它在 ios 13 及更低版本上运行良好,但在 iOS 14 上不起作用。有什么解决方案吗?