commit | author | age
|
bad748
|
1 |
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
W |
2 |
// |
|
3 |
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, |
|
4 |
// copy, modify, and distribute this software in source code or binary form for use |
|
5 |
// in connection with the web services and APIs provided by Facebook. |
|
6 |
// |
|
7 |
// As with any software that integrates with the Facebook platform, your use of |
|
8 |
// this software is subject to the Facebook Developer Principles and Policies |
|
9 |
// [http://developers.facebook.com/policy/]. This copyright notice shall be |
|
10 |
// included in all copies or substantial portions of the software. |
|
11 |
// |
|
12 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
13 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
14 |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
15 |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
16 |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
17 |
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
18 |
|
49b883
|
19 |
#import "TargetConditionals.h" |
L |
20 |
|
|
21 |
#if !TARGET_OS_TV |
|
22 |
|
bad748
|
23 |
#import <UIKit/UIKit.h> |
W |
24 |
|
e81c27
|
25 |
NS_ASSUME_NONNULL_BEGIN |
H |
26 |
|
9febd9
|
27 |
/** |
W |
28 |
FBSDKTooltipViewArrowDirection enum |
bad748
|
29 |
|
9febd9
|
30 |
Passed on construction to determine arrow orientation. |
bad748
|
31 |
*/ |
W |
32 |
typedef NS_ENUM(NSUInteger, FBSDKTooltipViewArrowDirection) |
|
33 |
{ |
9febd9
|
34 |
/** View is located above given point, arrow is pointing down. */ |
bad748
|
35 |
FBSDKTooltipViewArrowDirectionDown = 0, |
9febd9
|
36 |
/** View is located below given point, arrow is pointing up. */ |
bad748
|
37 |
FBSDKTooltipViewArrowDirectionUp = 1, |
e81c27
|
38 |
} NS_SWIFT_NAME(FBTooltipView.ArrowDirection); |
bad748
|
39 |
|
9febd9
|
40 |
/** |
W |
41 |
FBSDKTooltipColorStyle enum |
bad748
|
42 |
|
9febd9
|
43 |
Passed on construction to determine color styling. |
bad748
|
44 |
*/ |
W |
45 |
typedef NS_ENUM(NSUInteger, FBSDKTooltipColorStyle) |
|
46 |
{ |
9febd9
|
47 |
/** Light blue background, white text, faded blue close button. */ |
bad748
|
48 |
FBSDKTooltipColorStyleFriendlyBlue = 0, |
9febd9
|
49 |
/** Dark gray background, white text, light gray close button. */ |
bad748
|
50 |
FBSDKTooltipColorStyleNeutralGray = 1, |
e81c27
|
51 |
} NS_SWIFT_NAME(FBTooltipView.ColorStyle); |
bad748
|
52 |
|
9febd9
|
53 |
/** |
bad748
|
54 |
|
9febd9
|
55 |
Tooltip bubble with text in it used to display tips for UI elements, |
bad748
|
56 |
with a pointed arrow (to refer to the UI element). |
W |
57 |
|
9febd9
|
58 |
|
W |
59 |
|
bad748
|
60 |
The tooltip fades in and will automatically fade out. See `displayDuration`. |
W |
61 |
*/ |
e81c27
|
62 |
NS_SWIFT_NAME(FBTooltipView) |
bad748
|
63 |
@interface FBSDKTooltipView : UIView |
W |
64 |
|
9febd9
|
65 |
/** |
W |
66 |
Gets or sets the amount of time in seconds the tooltip should be displayed. |
|
67 |
Set this to zero to make the display permanent until explicitly dismissed. |
bad748
|
68 |
Defaults to six seconds. |
W |
69 |
*/ |
|
70 |
@property (nonatomic, assign) CFTimeInterval displayDuration; |
|
71 |
|
9febd9
|
72 |
/** |
W |
73 |
Gets or sets the color style after initialization. |
|
74 |
Defaults to value passed to -initWithTagline:message:colorStyle:. |
bad748
|
75 |
*/ |
W |
76 |
@property (nonatomic, assign) FBSDKTooltipColorStyle colorStyle; |
|
77 |
|
9febd9
|
78 |
/** |
W |
79 |
Gets or sets the message. |
bad748
|
80 |
*/ |
e81c27
|
81 |
@property (nonatomic, copy, nullable) NSString *message; |
bad748
|
82 |
|
9febd9
|
83 |
/** |
W |
84 |
Gets or sets the optional phrase that comprises the first part of the label (and is highlighted differently). |
bad748
|
85 |
*/ |
e81c27
|
86 |
@property (nonatomic, copy, nullable) NSString *tagline; |
bad748
|
87 |
|
9febd9
|
88 |
/** |
W |
89 |
Designated initializer. |
bad748
|
90 |
|
13e53a
|
91 |
@param tagline First part of the label, that will be highlighted with different color. Can be nil. |
bad748
|
92 |
|
13e53a
|
93 |
@param message Main message to display. |
bad748
|
94 |
|
13e53a
|
95 |
@param colorStyle Color style to use for tooltip. |
bad748
|
96 |
|
9febd9
|
97 |
|
W |
98 |
|
bad748
|
99 |
If you need to show a tooltip for login, consider using the `FBSDKLoginTooltipView` view. |
W |
100 |
|
9febd9
|
101 |
|
13e53a
|
102 |
@see FBSDKLoginTooltipView |
bad748
|
103 |
*/ |
e81c27
|
104 |
- (instancetype)initWithTagline:(nullable NSString *)tagline |
H |
105 |
message:(nullable NSString *)message |
|
106 |
colorStyle:(FBSDKTooltipColorStyle)colorStyle; |
bad748
|
107 |
|
9febd9
|
108 |
/** |
W |
109 |
Show tooltip at the top or at the bottom of given view. |
bad748
|
110 |
Tooltip will be added to anchorView.window.rootViewController.view |
W |
111 |
|
13e53a
|
112 |
@param anchorView view to show at, must be already added to window view hierarchy, in order to decide |
bad748
|
113 |
where tooltip will be shown. (If there's not enough space at the top of the anchorView in window bounds - |
W |
114 |
tooltip will be shown at the bottom of it) |
|
115 |
|
9febd9
|
116 |
|
W |
117 |
|
bad748
|
118 |
Use this method to present the tooltip with automatic positioning or |
W |
119 |
use -presentInView:withArrowPosition:direction: for manual positioning |
|
120 |
If anchorView is nil or has no window - this method does nothing. |
|
121 |
*/ |
|
122 |
- (void)presentFromView:(UIView *)anchorView; |
|
123 |
|
9febd9
|
124 |
/** |
W |
125 |
Adds tooltip to given view, with given position and arrow direction. |
bad748
|
126 |
|
13e53a
|
127 |
@param view View to be used as superview. |
bad748
|
128 |
|
13e53a
|
129 |
@param arrowPosition Point in view's cordinates, where arrow will be pointing |
bad748
|
130 |
|
13e53a
|
131 |
@param arrowDirection whenever arrow should be pointing up (message bubble is below the arrow) or |
bad748
|
132 |
down (message bubble is above the arrow). |
W |
133 |
*/ |
e81c27
|
134 |
- (void)presentInView:(UIView *)view |
H |
135 |
withArrowPosition:(CGPoint)arrowPosition |
|
136 |
direction:(FBSDKTooltipViewArrowDirection)arrowDirection |
|
137 |
NS_SWIFT_NAME(present(in:arrowPosition:direction:)); |
bad748
|
138 |
|
9febd9
|
139 |
/** |
W |
140 |
Remove tooltip manually. |
bad748
|
141 |
|
9febd9
|
142 |
|
W |
143 |
|
bad748
|
144 |
Calling this method isn't necessary - tooltip will dismiss itself automatically after the `displayDuration`. |
W |
145 |
*/ |
|
146 |
- (void)dismiss; |
|
147 |
|
|
148 |
@end |
e81c27
|
149 |
|
H |
150 |
NS_ASSUME_NONNULL_END |
49b883
|
151 |
|
L |
152 |
#endif |