Comments (4)
Solved!
Instead of using:
self.attributedText.string.characters.count
I am now using:
(self.attributedText.string as NSString).length
I will push a new version in a couple of minutes...
from attributedtextview.
Indeed there is something strange when using /r What's also strange that this behaviour only happens with the last url and only if there is nothing behind it. If you add 2 extra characters at the end (can be spaces) then it's ok again. I will try to find out what this could be.
from attributedtextview.
I did find the source of the problem. When doing a character count \r and \n will return 1 but a \r\n will also return 1. I search in a range using that character count. So the search will be executed in the string that is 2 characters short.
Here you can see this:
let cr = "\r"
cr.characters.count // 1
let lf = "\n"
lf.characters.count // 1
let crlf = "\r\n"
crlf.characters.count // 1
My quick solution would be replacing the \r\n into a \n
I will try out to find more information about this Swift bug / strange behaviour.
from attributedtextview.
It's now pushed as version 0.5.3
from attributedtextview.
Related Issues (20)
- Laggy scrolling with AttributedTextView inside tableViewCell HOT 3
- Problem with custom hyperlinks inside the brackets HOT 2
- AttributedTextView's append(_:) method in String+Attributer.swift conflicts with Swift's append(_:) HOT 1
- fixed
- Can this work in iOS 9? HOT 6
- WARN | xcodebuild HOT 3
- Setting of attributer changes selectable and editable HOT 4
- The example does not run and complains about image not found ? HOT 1
- Disable selection for textView HOT 4
- Error when compiling in xcode 10 swift 4.2 HOT 2
- How to match https HOT 1
- UITextViewDelegate should return values based on isEditable HOT 2
- How can I change truncation text when textview clip? HOT 3
- Default font changes in Xcode 11 HOT 3
- Update padding between underline and text HOT 1
- <a href> </a> Anchor tags are not clickable (only detected as html link) HOT 2
- Using Swift Package Manager HOT 3
- i have one tableview in that i have lots of different arabic word in every tableview cell. i want position of clicked text. because i want to open popup at particulate text click with particulate text own content like translation.how can i can get absolute position of clicked text?
- Tag for latest version HOT 1
- Match hashtag with emoji iOS 16 HOT 4
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 attributedtextview.