Comments (5)
please refer to this updated link:
http://upload.ugm.ac.id/133OHAttributedLabel-master%202.zip
I want to use this callout view for attributed texts.
so I want after touching every attributed text, the callout view appears above the text. but it seems there is something wrong that I can't figure out!
How can I display it above every attributed text?
[calloutView presentCalloutFromRect:_demoLabel.frame inView:_demoLabel constrainedToView:_demoLabel permittedArrowDirections:SMCalloutArrowDirectionDown animated:YES];
from calloutview.
Hello,
What's happening here is that you're asking the popup to display pointing at the entire OHAttributedLabel
surface, which it's doing correctly.
What I think you actually want is to tell the popup to appear pointing at the CGRect defined by just the area of the link that was clicked. However, OHAttributedLabel
doesn't seem to support giving you the rect of a particular link.
One thing you might try is to intercept and track touches yourself in the superview of your OHAttributedLabel
to figure out the X/Y position of where the user's finger is, then you could present the callout above that point.
Anything else would require hacking OHAttributedLabel
, which might be a bit complex.
I'm closing this issue as I believe SMCalloutView
is behaving correctly here.
Good luck!
Nick
from calloutview.
thanks for your guides
I followed you response and could solve the problem.
I used
CGRect CTRunGetTypographicBoundsAsRect(CTRunRef run, CTLineRef line, CGPoint lineOrigin);
to find the exact position of links.
so everything worked well. but after adding the label to a UIScrollView (because the string in the label is very long).
another problem raised. the SMCalloutView locks on a specific position, and all the time appears above that.
I couldn't understand why acts like this. so I've uploaded them and posted a link in #24 issue.
I appreciate if you could tell me why it is happening!!
from calloutview.
That's great that you got it working! I didn't know about CTRunGetTypographicBoundsAsRect
, that's exactly what was needed.
What view are you adding the callout to? If the result of CTRunGetTypographicBoundsAsRect
is an x/y position in the coordinate system of the label, then you'll probably want to make sure the calloutview is presented inside the scrollview somewhere.
from calloutview.
touching delay solved!
the solution is here:
http://stackoverflow.com/questions/3642547/uibutton-touch-is-delayed-when-in-uiscrollview
from calloutview.
Related Issues (20)
- The current deployment target does not support automated __weak references HOT 2
- Xcode Warning when clear custom view set by another pin HOT 1
- Add support for tvOS MapKit 😊 added in 9.2 HOT 2
- animationDidStop delegate callback checks for finished HOT 3
- Crashing on CLLayer position contains NaN HOT 7
- Swift 3 support? HOT 1
- How to change the background HOT 1
- Content View Touch - weird behaviour HOT 2
- Crashing when annotation is selected programmatically in viewDidLoad
- Is it possible to increase the view height and allow a multiline subtitle? HOT 16
- Is it possible to add a touch event to the calloutview?
- convert to swift HOT 7
- Contentview with constraints fails HOT 1
- Using SMCalloutView wit Mapbox HOT 3
- Performance issues HOT 2
- Crash when tap near the screen edges HOT 3
- Increase Callout Popup delay HOT 5
- calloutView with AutoLayout
- Not issue but Question : Calloutview with Mapbox HOT 6
- Refresh callout view in calloutViewClicked HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calloutview.