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