-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feature request: NSTextAttachment #492
Comments
+1 |
2 similar comments
+1 |
+1 |
I've been thinking about moving all the drawing responsibility to |
FWIW, I only support >= 7 anyway. |
+1 |
Does anybody know good workaround, how images can be embedded to uilabel? |
If anyone wants to collaborate, the So far:
I haven't had time to test it beyond this initial gutting, but I think you should now be able to embed text attachments like so: NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"aaron-brager-avatar.png"];
NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
NSMutableAttributedString *myString= [[NSMutableAttributedString alloc] initWithString:@"Aaron Brager"];
[myString appendAttributedString:attachmentString];
myLabel.attributedText = myString; @jhersh - Is this an approach you'd be interested in collaborating on? If so, since it's far from production-ready, would you prefer to work on a branch / track issues here, or should I continue on my fork? I want to avoid stepping on any toes. |
Very exciting @getaaron!
That is unfortunate; iOS 4.3 support has long been a hallmark feature of TTTAttributedLabel. I'm not sure how we would measure deployments of the label on older systems, but I imagine it is still fairly popular. It'd be a real shame to lose this even though it'd also mean simpler drawing and much less code. Still, I imagine it's only a matter of time until one reason or another leads us to drop older systems.
This also means that support for This sounds like a fairly major change. We'll want to try for feature parity to the best extent we can, even if there are breaking syntax/property changes. |
@jhersh As you suspected, those features are all currently broken. Some of them can be trivially reimplemented, although I'm not sure they all need to be. For those you mentioned:
|
My app uses >=iOS7, so easily switched to native UITextView. It supports links and images - all I need |
It is possible to implement this using the current CoreText engine and not fork the implementation, right? We would scan the incoming text with NSTextAttachmentAttributeName and embed a CTRunDelegateRef on the string for these regions that would allow us to leave space inline in the text. In the drawing pass you get the attachment cell and request it draw within the region left. |
@ocrickard That does sound promising! I would welcome a pull request with those changes. |
Folks, if NSTextAttachment with image supported in version 2.0.0 ? |
|
+1 |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
Is |
NSTextAttachment is still unsupported, you can choose YYtext. |
As mentioned in #447,
TTTAttributedLabel
does not supportNSTextAttachment
. This was surprising, and undesirable.This is a feature request for
NSTextAttachment
support.The text was updated successfully, but these errors were encountered: