BPKTappableLinkLabel
@interface BPKTappableLinkLabel : UIView
BPKTappableLinkLabel
is a subclass of UIView
which uses the Skyscanner style for labels containing tappable text.
-
this determines the number of lines to draw and what to do when sizeToFit is called. default value is 1 (single line). A value of 0 means no limit if the height of the text reaches the # of lines or the height of the view is less than the # of lines allowed, the text will be truncated using the line break mode.
Declaration
Objective-C
@property (nonatomic) NSInteger numberOfLines;
Swift
var numberOfLines: Int { get set }
-
The technique to use for aligning the text. Default is NSLineBreakByTruncatingTail used for single and multiple lines of text
Declaration
Objective-C
@property (nonatomic) NSTextAlignment textAlignment;
Swift
var textAlignment: NSTextAlignment { get set }
-
The technique to use for wrapping and truncating the label’s text. Default is NSLineBreakByTruncatingTail used for single and multiple lines of text.
Declaration
Objective-C
@property (nonatomic) NSLineBreakMode lineBreakMode;
Swift
var lineBreakMode: NSLineBreakMode { get set }
-
The color of the label’s non-link text. Setting this does not affect the color of alternate labels.
Declaration
Objective-C
@property (nonatomic) UIColor *_Nonnull textColor;
Swift
var textColor: UIColor { get set }
-
The font style used to display the text.
See
BPKFontStyleDeclaration
Objective-C
@property (nonatomic) BPKFontStyle fontStyle;
Swift
var fontStyle: Int32 { get set }
-
The style of tappable label to use
See
BPKTappableLabelStyleDeclaration
Objective-C
@property (nonatomic) BPKTappableLinkLabelStyle style;
Swift
var style: BPKTappableLinkLabelStyle { get set }
-
The text displayed by the receiver. Setting this clears all configured tappable links.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *text;
Swift
var text: String? { get set }
-
The size required to draw the the view with the current configuration.
This method may return fractional sizes. When setting the size of your view, use the ceil function to fractional values up to the nearest whole number.
This methods delegates to size method of
NSattributedString
.Declaration
Objective-C
@property (nonatomic, readonly) CGSize size;
Swift
var size: CGSize { get }
-
The receiver’s delegate. Used to communicate interactions with the receiver.
Declaration
Objective-C
@property (nonatomic, weak) id<BPKTappableLinkLabelDelegate> _Nullable delegate;
Swift
weak var delegate: BPKTappableLinkLabelDelegate? { get set }
-
Create a
BPKTappableLinkLabel
with a specific BPKFont style.See
BPKFontStyleDeclaration
Objective-C
- (nonnull instancetype)initWithFontStyle:(BPKFontStyle)style;
Swift
init(fontStyle style: Any!)
Parameters
style
Font style to be used by the label.
-
Creates a
BPKTappableLinkLabel
with a decoder (typically when creating from Storyboards)Declaration
Objective-C
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;
Swift
init?(coder aDecoder: NSCoder)
Parameters
aDecoder
Decoder object to extract parameters from
Return Value
BPKTappableLinkLabel
instance. -
Create a
BPKTappableLinkLabel
with a given frame.Declaration
Objective-C
- (nonnull instancetype)initWithFrame:(CGRect)frame;
Swift
init(frame: CGRect)
Parameters
frame
The initial frame of the button.
Return Value
BPKTappableLinkLabel
instance. -
Add a tappable section to the label.
Declaration
Objective-C
- (nonnull instancetype)addLinkToURL:(nonnull NSURL *)url withRange:(NSRange)range;
Swift
func addLink(to url: URL, with range: NSRange) -> Self
Parameters
url
The URL to open when the link is tapped.
range
The range of characters in the TappableLinkLabel to apply the link to.
-
Add a tappable section to the label.
Declaration
Objective-C
- (nonnull instancetype)addLinkToTransitInformation: (nonnull NSDictionary *)components withRange:(NSRange)range;
Swift
func addLink(toTransitInformation components: [AnyHashable : Any], with range: NSRange) -> Self
Parameters
components
The Transit Information used to signify the event when the link is tapped.
range
The range of characters in the TappableLinkLabel to apply the link to.