- Welcome
- Getting started
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- Code
- Content Cards
- Data Table
- Datepicker
- Description List
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat List
- Flight Leg
- Floating Action Button
- Floating Notification
- Form Label
- Form Validation
- Graphic Promotion
- Horizontal Navigation
- Icon
- Image
- Infinite Scroll
- Link
- List
- Map
- Mobile Scroll Container
- Modal
- Navigation Bar
- Nudger
- Overlay
- Page Indicator
- Pagination
- Panel
- Phone Input
- Picker
- Popover
- Price
- Progress Bar
- Radio Button
- Rating
- Scrollable Calendar
- Section List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- Spinner
- Split Input
- Star Rating
- Switch
- Table
- Text
- Text Input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable Native Feedback
- Touchable Overlay
- Content
- Accessibility
Link
This component enables links to other resources, pages or views.
Backpack/TappableLinkLabel
With multiple links
Day | Night |
---|---|
![]() |
![]() |
Alternate style
Day | Night |
---|---|
![]() |
![]() |
Usage
BPKTappableLinkLabel is a view that renders flowing text that can include tappable links as part of its content.
Objective-C
#import <Backpack/TappableLinkLabel.h>
BPKTappableLinkLabel *tappableLinkLabel = [[BPKTappableLinkLabel alloc] initWithFontStyle:BPKFontStyleTextBase];
tappableLinkLabel.text = @“Find out more about our terms of service.”
tappableLinkLabel.delegate = self;
[tappableLinkLabel addLinkToURL:[NSURL URLWithString:@"http:..."] withRange:NSRange(location:24, length:16)];
[tappableLinkLabel addLinkToTransitInformation:@{} withRange:NSRange(location:24, length:16)];
// Position label with autolayout or other method
// Apply alternative style:
tappableLinkLabel.style = BPKTappableLinkLabelStyleAlternative;
// Apply custom text color:
tappableLinkLabel.textColor = BPKColor.panjin;
...
#pragma mark - <BPKTappableLinkLabelDelegate>
- (void)tappableLabel:(BPKTappableLinkLabel *)label didSelectLinkWithURL:(NSURL *)url {
[_presenter urlTapped:url];
}
- (void)tappableLabel:(BPKTappableLinkLabel *)label didSelectLinkWithTransitInformation:(NSDictionary *)components {
// do stuff
}
Swift
import Backpack
let tappableLinkLabel = BPKTappableLinkLabel(fontStyle: .textBase)
tappableLinkLabel.text = “Find out more about our terms of service.”
tappableLinkLabel.delegate = self
tappableLinkLabel.addLink(to: URL(string: "https:...")!, withRange: Range(location:24, length:16))
tappableLinkLabel.addLink(toTransitInformation: ["identifier": "some link thing"], withRange: Range(location:24, length:16))
// Position label with autolayout or other method
// Apply alternative style:
tappableLinkLabel.style = .alternative
// Apply custom text color:
tappableLinkLabel.textColor = BPKColor.panjin
...
extension MyClass: BPKTappableLinkLabelDelegate {
func tappableLabel(_ label: BPKTappableLinkLabel, didSelectLinkWith url: URL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
func tappableLabel(_ label: BPKTappableLinkLabel,
didSelectLinkWithTransitInformation components: [AnyHashable: Any]) {
print(components)
}
}
Appearance attributes
- (UIColor)linkContentColor
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Feb 14, 2023, 16:57