- iOS 10.3+
- ARC
Download this repo
To use just the text view in your own nibs / storyboards etc, copy the MPC_LinkedTextView{.h/.m} files into your project.
If you need a custom UITableViewCell to show linked text, also copy the MPC_LinkedTextViewCell {.h/.m/.xib} files. Remember to register the nib file in your UITableView subclass before using these cells.
-
In a xib or storyboard, set the MPC_LinkedTextView as the custom class of your UITextView object in the Identity Inspector.
-
Create an outlet:
@property (weak, nonatomic) IBOutlet MPC_LinkedTextView *linkedTextView;
- Call the public method:
updateTextViewWithFullText: linkTriggerText: linkURLString:
-
Register the nib as shown in LinkedTableViewController
-
After instantiating a cell, set the text via the .linkedTextView property of the MPC_LinkedTextViewCell
MPC_LinkedTextViewCell *cell = [table dequeueReusableCellWithIdentifier:[MPC_LinkedTextViewCell reuseID] forIndexPath:path];
[cell.linkedTextView updateTextViewWithFullText:@"For the best pizza in Thailand, try New York Pizza House" linkTriggerText:@"New York Pizza House" linkURLString:@"https://www.newyorkpizza.co.th"];
- Dig into MPC_LinkedTextView.m to customize how the textView appears visually and spacially.