UIView内存崩溃

时间:2016-01-21 13:34:12

标签: ios objective-c swift memory-management uiview

我有GMSMapView并且在其上我想要使用UITableView获得额外的UIView。

let shopListView = UIView(frame: CGRectMake(0,0,UIScreen.mainScreen().bounds.width, 500))
shopListView.backgroundColor = UIColor.redColor()
tableView = UITableView(frame: CGRectMake(0,0,UIScreen.mainScreen().bounds.width, 500))
shopListView.addSubview(tableView!)
tableView!.delegate = self
tableView!.dataSource = self
tableView!.registerNib(UINib(nibName: "TableViewCell", bundle: nil), forCellReuseIdentifier: "explore")
self.mapView.addSubview(shopListView)
print(tableView!.delegate)
tableView!.reloadData()

经过一些更改后,我正在显示此视图,如

func showShopViewList() {
    UIView.animateWithDuration(0.8, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: { () -> Void in
        self.shopListView.alpha = 1.0
        }, completion: nil)
}

以同样的方式隐藏。

问题是 - 消耗的内存是300 MB,如果没有添加此视图 - 60 MB,而iPhone 4s正在崩溃,因为这对他来说很难。你能提出一些建议来实现这个功能吗?

0 个答案:

没有答案