Git Product home page Git Product logo

Comments (5)

haashem avatar haashem commented on June 27, 2024

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];

Screen Shot 2013-01-11 at 7 16 42 PM

from calloutview.

nfarina avatar nfarina commented on June 27, 2024

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.

haashem avatar haashem commented on June 27, 2024

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!!

Screen Shot 2013-01-14 at 10 27 38 PM
Screen Shot 2013-01-14 at 10 31 06 PM

from calloutview.

nfarina avatar nfarina commented on June 27, 2024

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.

haashem avatar haashem commented on June 27, 2024

touching delay solved!
the solution is here:
http://stackoverflow.com/questions/3642547/uibutton-touch-is-delayed-when-in-uiscrollview

from calloutview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.