iOS Question Set Link Text Color in CSBuilder

Jim McDougal

Member
Licensed User
Is there any way to set the text color of a link in CSBuilder? I can set the color of all the other text in the string but iOS seems to want to stay with this washed out pastel shade of blue for the link text.
 

Jim McDougal

Member
Licensed User
So ... this looks like Objective C code, not B4i. Where would I put it in my program?

#if OBJC
// Here fixed attributes are used. Could be expanded to be customizable
-(void) changeTextViewLinkAttributes:(UITextView*) textView {

NSDictionary *linkAttributes = @{NSForegroundColorAttributeName: [UIColor greenColor],
NSUnderlineColorAttributeName: [UIColor lightGrayColor],
NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)};
textView.linkTextAttributes = linkAttributes;
}
#End If
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
It is inline-objective C. Just need to copy the lines somewhere (for instance, at the end) of the b4i class/module from where you will use it, and call that code as it is done in the example.
It works for Textviews, perhaps you'll need another approach depending on your specific case.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Is there any way to set the text color of a link in CSBuilder? I can set the color of all the other text in the string but iOS seems to want to stay with this washed out pastel shade of blue for the link text.
what about this workaround - use a label and click event?
 
Upvote 0

Jim McDougal

Member
Licensed User
So, if I can successfully convert a ColorToUIColor, how would I pass this as a variable to the OBJC code section and make the link colors selectable instead of constant?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0
Top