映射视图在动态表视图单元格中缩小

时间:2017-07-28 05:47:50

标签: swift dynamic maps tableview

在一个快速的iOS应用程序中,我在viewController中有一个带有2个原型单元格的tableView。一个单元格有两个文本框(单元格),其他单元格有一个UIview(MapCell中的mapView),我必须在其中显示带有一些位置标记的谷歌地图视图。我为单元格中的所有内容设置了前导,拖尾,顶部和底部约束。此外,还包括以下动态单元格。

chatMessagesTableView.rowHeight = UITableViewAutomaticDimension
chatMessagesTableView.estimatedRowHeight = 100

第一个单元格根据内容大小获得动态高度,但是MapCell缩小了,尝试了很多东西而没有任何帮助,请建议我可以做些什么。这是一个相关的代码和tableview单元格图像。

let cell = tableView.dequeueReusableCell(withIdentifier: "MapCell", for: indexPath) as! tableViewCell

googleMapView.frame = CGRect(x: 0, y: 0, width: 400, height: 300)
let camera = GMSCameraPosition.camera(withLatitude:self.tripLocation.latitude, longitude: self.tripLocation.longitude, zoom: 15)

 googleMapView.animate(to: camera)
 cell.mapView.addSubview(googleMapView)
 cell.mapView.sizeToFit()
 cell.updateConstraints()
 cell.updateConstraintsIfNeeded()

Click here for Image of table View

还有一个问题是,当我向下滚动表格时,下一个单元格会被约束弄乱,例如文本对齐!请帮我解决这个问题。我正在阅读很多关于约束和布局的教程,但是没有什么真正有效!

0 个答案:

没有答案
相关问题