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