commit | author | age
|
2e29a3
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import "TargetConditionals.h" |
|
10 |
|
|
11 |
#if !TARGET_OS_TV |
|
12 |
|
|
13 |
#import <UIKit/UIKit.h> |
|
14 |
|
|
15 |
NS_ASSUME_NONNULL_BEGIN |
|
16 |
|
|
17 |
/** |
|
18 |
FBSDKTooltipViewArrowDirection enum |
|
19 |
|
|
20 |
Passed on construction to determine arrow orientation. |
|
21 |
*/ |
|
22 |
typedef NS_ENUM(NSUInteger, FBSDKTooltipViewArrowDirection) { |
|
23 |
/** View is located above given point, arrow is pointing down. */ |
|
24 |
FBSDKTooltipViewArrowDirectionDown = 0, |
|
25 |
/** View is located below given point, arrow is pointing up. */ |
|
26 |
FBSDKTooltipViewArrowDirectionUp = 1, |
|
27 |
} NS_SWIFT_NAME(FBTooltipView.ArrowDirection); |
|
28 |
|
|
29 |
/** |
|
30 |
FBSDKTooltipColorStyle enum |
|
31 |
|
|
32 |
Passed on construction to determine color styling. |
|
33 |
*/ |
|
34 |
typedef NS_ENUM(NSUInteger, FBSDKTooltipColorStyle) { |
|
35 |
/** Light blue background, white text, faded blue close button. */ |
|
36 |
FBSDKTooltipColorStyleFriendlyBlue = 0, |
|
37 |
/** Dark gray background, white text, light gray close button. */ |
|
38 |
FBSDKTooltipColorStyleNeutralGray = 1, |
|
39 |
} NS_SWIFT_NAME(FBTooltipView.ColorStyle); |
|
40 |
|
|
41 |
/** |
|
42 |
|
|
43 |
Tooltip bubble with text in it used to display tips for UI elements, |
|
44 |
with a pointed arrow (to refer to the UI element). |
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
The tooltip fades in and will automatically fade out. See `displayDuration`. |
|
49 |
*/ |
|
50 |
NS_SWIFT_NAME(FBTooltipView) |
|
51 |
@interface FBSDKTooltipView : UIView |
|
52 |
|
|
53 |
/** |
|
54 |
Gets or sets the amount of time in seconds the tooltip should be displayed. |
|
55 |
Set this to zero to make the display permanent until explicitly dismissed. |
|
56 |
Defaults to six seconds. |
|
57 |
*/ |
|
58 |
@property (nonatomic, assign) CFTimeInterval displayDuration; |
|
59 |
|
|
60 |
/** |
|
61 |
Gets or sets the color style after initialization. |
|
62 |
Defaults to value passed to -initWithTagline:message:colorStyle:. |
|
63 |
*/ |
|
64 |
@property (nonatomic, assign) FBSDKTooltipColorStyle colorStyle; |
|
65 |
|
|
66 |
/** |
|
67 |
Gets or sets the message. |
|
68 |
*/ |
|
69 |
@property (nullable, nonatomic, copy) NSString *message; |
|
70 |
|
|
71 |
/** |
|
72 |
Gets or sets the optional phrase that comprises the first part of the label (and is highlighted differently). |
|
73 |
*/ |
|
74 |
@property (nullable, nonatomic, copy) NSString *tagline; |
|
75 |
|
|
76 |
/** |
|
77 |
Designated initializer. |
|
78 |
|
|
79 |
@param tagline First part of the label, that will be highlighted with different color. Can be nil. |
|
80 |
|
|
81 |
@param message Main message to display. |
|
82 |
|
|
83 |
@param colorStyle Color style to use for tooltip. |
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
If you need to show a tooltip for login, consider using the `FBSDKLoginTooltipView` view. |
|
88 |
|
|
89 |
|
|
90 |
@see FBSDKLoginTooltipView |
|
91 |
*/ |
|
92 |
- (instancetype)initWithTagline:(nullable NSString *)tagline |
|
93 |
message:(nullable NSString *)message |
|
94 |
colorStyle:(FBSDKTooltipColorStyle)colorStyle; |
|
95 |
|
|
96 |
/** |
|
97 |
Show tooltip at the top or at the bottom of given view. |
|
98 |
Tooltip will be added to anchorView.window.rootViewController.view |
|
99 |
|
|
100 |
@param anchorView view to show at, must be already added to window view hierarchy, in order to decide |
|
101 |
where tooltip will be shown. (If there's not enough space at the top of the anchorView in window bounds - |
|
102 |
tooltip will be shown at the bottom of it) |
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
Use this method to present the tooltip with automatic positioning or |
|
107 |
use -presentInView:withArrowPosition:direction: for manual positioning |
|
108 |
If anchorView is nil or has no window - this method does nothing. |
|
109 |
*/ |
|
110 |
- (void)presentFromView:(UIView *)anchorView; |
|
111 |
|
|
112 |
/** |
|
113 |
Adds tooltip to given view, with given position and arrow direction. |
|
114 |
|
|
115 |
@param view View to be used as superview. |
|
116 |
|
|
117 |
@param arrowPosition Point in view's cordinates, where arrow will be pointing |
|
118 |
|
|
119 |
@param arrowDirection whenever arrow should be pointing up (message bubble is below the arrow) or |
|
120 |
down (message bubble is above the arrow). |
|
121 |
*/ |
|
122 |
|
|
123 |
// UNCRUSTIFY_FORMAT_OFF |
|
124 |
- (void)presentInView:(UIView *)view |
|
125 |
withArrowPosition:(CGPoint)arrowPosition |
|
126 |
direction:(FBSDKTooltipViewArrowDirection)arrowDirection |
|
127 |
NS_SWIFT_NAME(present(in:arrowPosition:direction:)); |
|
128 |
// UNCRUSTIFY_FORMAT_ON |
|
129 |
|
|
130 |
/** |
|
131 |
Remove tooltip manually. |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
Calling this method isn't necessary - tooltip will dismiss itself automatically after the `displayDuration`. |
|
136 |
*/ |
|
137 |
- (void)dismiss; |
|
138 |
|
|
139 |
@end |
|
140 |
|
|
141 |
NS_ASSUME_NONNULL_END |
|
142 |
|
|
143 |
#endif |