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

NIAttributedLabel #358

Merged
merged 3 commits into from Mar 26, 2013

Conversation

Projects
None yet
2 participants
@migrant
Copy link
Contributor

migrant commented Mar 8, 2013

Adding links after images, the AttributedLabel fall to detect link
touch and give the correct highlight rect

migrant added some commits Mar 8, 2013

S
D
Revert "S"
This reverts commit 1b28a2f.

@migrant migrant closed this Mar 8, 2013

@migrant migrant reopened this Mar 8, 2013

NSUInteger offset = 0;
for (NIAttributedLabelImage *labelImage in self.images) {
if (labelImage.index < idx) {
offset++;

This comment has been minimized.

@jverkoey

jverkoey Mar 14, 2013

Owner

Can you add a comment explaining what this is doing?

This comment has been minimized.

@migrant

migrant Mar 14, 2013

Author Contributor

If I insert a image at index m then after it add a link at index n (i.e n > m), after drawing text the link location is added by 1 in attributed string because NIAttributedLabel insert a 0xFFFC into attributed string for every image. In this case, the link location is n+1 in attributed string but is still n in the NSArray detectedlinkLocations or explicitLinkLocations.
When touching a character before which there are images, CTLineGetStringIndexForPosition(line, relativePoint) returns the actual index but I must provide a original index for [self linkAtIndex:idx] to determine whether I touch a link.So I must know how many images before and calcute the correct index.

jverkoey added a commit that referenced this pull request Mar 26, 2013

@jverkoey jverkoey merged commit 16e0ecc into jverkoey:master Mar 26, 2013

@jverkoey

This comment has been minimized.

Copy link
Owner

jverkoey commented Mar 26, 2013

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment