Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIView.image does not capture subviews #276

Open
skhillon opened this issue Mar 30, 2020 · 0 comments · May be fixed by #277
Open

UIView.image does not capture subviews #276

skhillon opened this issue Mar 30, 2020 · 0 comments · May be fixed by #277

Comments

@skhillon
Copy link

Summary

When I use the LocationAnnotationNode(location:view:) constructor, the view.image extension does not capture subviews such as labels when converting to UIImage.

For some reason (and I am not entirely sure why), this problem goes away when I call view.addSubview(cardView), but this also adds a new view to the window.

Code

  func addARAsset(poi: AliasablePOI) {
    let coordinate = CLLocationCoordinate2D(latitude: poi.latitude, longitude: poi.longitude)
    let location = CLLocation(coordinate: coordinate, altitude: Constants.AR.altitudeInMeters)
    let cardView = ARCardView(poi: poi)
    //view.addSubview(cardView)  <-- required
    let annotationNode = LocationAnnotationNode(location: location, view: cardView)
    annotationNode.scaleRelativeToDistance = false
    sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationNode)
  }

Without addSubview

IMG_8410

After addSubview

IMG_8411

@skhillon skhillon linked a pull request Mar 30, 2020 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant