Skip to content
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

Attributed strings for title and/or description labels? #115

Open
alexcosmin opened this issue Jun 19, 2015 · 8 comments
Open

Attributed strings for title and/or description labels? #115

alexcosmin opened this issue Jun 19, 2015 · 8 comments

Comments

@alexcosmin
Copy link

Hey! Great component, behaves awesome.

One question though: would it be possible to use attributed strings for the title text and/or description text of an intro page?
Let's say I would like to have a description text as String with a link where link would be underlined.

var string = NSMutableAttributedString(string: "String with a link")
let linkRange = NSMakeRange(14, 4)
let linkAttributes : [NSObject: AnyObject]? = [NSUnderlineStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue]
string.setAttributes(linkAttributes, range: linkRange)

var page2 = EAIntroPage()
page2.desc = string

Last line from above produces the error Cannot assign a value of type 'NSMutableAttributedString' to a value of type 'String!'.

My goal is to have a tappable portion (also underlined) of a description text, that opens a link with the browser.

I think in order to achieve this, the description label should be exposed in EAIntroPage.h, so I could set its attributedText property.

Any input?

@ealeksandrov
Copy link
Owner

Hey,
good idea. But I don't really like exposing UI elements, how about just supporting attributed strings in desc and title properties of EAIntroPage?

Will try this out on next week.

@alexcosmin
Copy link
Author

@ealeksandrov Supporting attributed strings in the properties of EAIntroPage would be perfect.
Thank you for your quick reply!

@StormFactory
Copy link

@ealeksandrov I wanted to follow up on this. I'm guessing that @alexcosmin wants to be able to add text that has links to a Terms of Service and Privacy Policy. That's what I'm looking to do as well. In my case instead of a direct link, I want to be able to use @selector to be able to call a block of code where I can then call another viewController or in Alex's case a link.

@timbroder
Copy link

@ealeksandrov I'm looking to do this as well. Any word on supporting attributed strings? Thanks

@ealeksandrov
Copy link
Owner

This is certainly in plans for future release but I can't guarantee any exact estimates. PRs welcome :)

@timbroder
Copy link

I'll try to find some time in the next week or so (we're launching in a few weeks, this might be right after that).

Do you have an opinion on moving desc to an attributed string and breaking backwards compatibility, or have both options side by side?

@ealeksandrov
Copy link
Owner

ealeksandrov commented Oct 25, 2016

  1. I'm ok with breaking backward compatibility if you provide nice API solution.
  2. Anyway it shouldn't work only with NSAttributedString - this will require more boilerplate code for 90% of use cases.

@timbroder
Copy link

roger

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

No branches or pull requests

4 participants