facebookarchive / AsyncDisplayKit

Smooth asynchronous user interfaces for iOS apps.

Home Page:http://asyncdisplaykit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can i use custom mapview in ASDK?

DGLY opened this issue · comments

commented

I want to use MAMapview in the project ,but I found only supports the native maps,so how can I solve this problems

please post your issue in Texture GitHub repository: https://github.com/TextureGroup/Texture

@DGLY You can wrap any UIView by using [[ASDisplayNode alloc] initWithViewBlock:^{ // configure and return custom view }];

You can even set customNode.style parameters to control layout behavior and add these nodes to ASLayoutSpec trees in layoutSpecThatFits.

Feel free to ask further questions on the Texture repository or join the Slack channel (you'll get better responses there).

this how I do in init method of my custom node:

mapNode = ASDisplayNode(viewBlock: { () -> UIView in
            let location = CLLocationCoordinate2D(latitude: 35.727541, longitude: 51.488807)
            let camera = GMSCameraPosition.camera(withLatitude: location.latitude, longitude: location.longitude, zoom: 14)
            let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
            mapView.settings.setAllGesturesEnabled(false)
            
            // add event location on the map
            let marker = GMSMarker()
            
            marker.position = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
            marker.map = mapView
            let eventMarker = VenueMarker()
            eventMarker.tintColor = .secondaryColor
            marker.iconView = eventMarker
            return mapView
        })
commented

This method is really can resolve the custom map view,but i don't konw how to use this custom node add more annotation,i just konw use ASMapnode to do this.