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

greatly reduced performance during presentCalloutFromRect:... #61

Closed
incanus opened this issue Mar 18, 2014 · 4 comments
Closed

greatly reduced performance during presentCalloutFromRect:... #61

incanus opened this issue Mar 18, 2014 · 4 comments

Comments

@incanus
Copy link
Contributor

incanus commented Mar 18, 2014

Related issue: mapbox/DEPRECATED-mapbox-ios-sdk#421

This might not necessarily be a primary concern of this library, but I wanted to flag it.

One thing we do over in my project is to move the callout with the map's pan and zoom. On pan, the callout's layer is just moved around; no big deal. But on zoom, we repeatedly call -presentCalloutFromRect:inLayer:constrainedToLayer:animated: when the callout is on a vector shape in order to adjust the callout position in a more dynamic way than for simple points.

In the new iOS 7 version as of 58ce460, calling this has much higher overhead since it works its way down to -[SMCalloutMaskedBackgroundView contentMask], which in turn calls -[CALayer renderInContext:].

I'm not sure how much trouble this is, but I'm going to look into modifying my library to possibly not reposition this way.

@nfarina
Copy link
Owner

nfarina commented Mar 18, 2014

Hm. What if you moved the existing callout by just modifying its frame directly?

@incanus
Copy link
Contributor Author

incanus commented Mar 18, 2014

In my case, I'm never setting or getting the callout's frame, as initial presentation is done via the same -present... call. Then, on zoom changes (this is UIScrollView-based), I'm calling the same routine to re-present, much like you would with a UIPopoverController. One advantage of this approach in the old version was that the callout's arrow position would adjust based on the attach point. So I was basically taking advantage of the callout's internal layout to truly re-present as circumstances had changed.

@nfarina
Copy link
Owner

nfarina commented Mar 18, 2014

Ah, I see. Yeah, this will definitely not be optimal with the new background drawing. Maybe there's a more clever/lightweight way to render the masked background.

@incanus
Copy link
Contributor Author

incanus commented Mar 18, 2014

I'm going to close this as I don't want to support the requisite feature in our project anymore. Just note that callouts can't be re-presented in this way, but that's probably a small minority of use cases, if at all. Thanks @nfarina!

@incanus incanus closed this as completed Mar 18, 2014
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

No branches or pull requests

2 participants