我正在使用google maps SDK&amp ;;快速实现iOS应用程序SMCalloutView。 当显示字幕SMCalloutView的长文本时,我想知道如何通过折叠文本来显示它。
我的代码摘录如下。
@IBOutlet weak var mapView: GMSMapView!
var calloutView = SMCalloutView()
var emptyCalloutView: UIView!
override func viewWillAppear(animated: Bool) {
var marker = GMSMarker()
marker.title = "Tokyo Tower"
marker.snippet = "subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle subtitle "
marker.position = CLLocationCoordinate2DMake(35.658582, 139.745433)
marker.map = self.mapView
self.mapView.selectedMarker = marker
let camera = GMSCameraPosition.cameraWithLatitude(marker.position.latitude, longitude: marker.position.longitude, zoom: kZoomLevel)
self.mapView.camera = camera
}
func mapView(mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView {
let anchor:CLLocationCoordinate2D = marker.position
let point:CGPoint = mapView.projection.pointForCoordinate(anchor)
self.calloutView.title = marker.title
self.calloutView.subtitle = marker.snippet
self.calloutView.calloutOffset = CGPointMake(0, -kCalloutYOffset)
self.calloutView.hidden = false
var calloutRect: CGRect = CGRectZero
calloutRect.origin = point
calloutRect.size = CGSizeZero
self.calloutView.presentCalloutFromRect(calloutRect, inView: mapView, constrainedToView: mapView, animated: true)
return self.emptyCalloutView
}
任何建议都是相关的。提前谢谢。