Tooltip component

更新时间:
复制 MD 格式

AUPopTipView is a component that displays a tooltip.

Preview

API reference

typedef NS_ENUM(NSInteger, AUPopViewIndicatorDirection) {
    AUPopViewIndicatorDirectionUp,
    AUPopViewIndicatorDirectionDown,
};

@interface AUPopTipView : AUPopDrawBoardView

AU_UNAVAILABLE_INIT

@property (nonatomic, assign) AUPopViewIndicatorDirection indicatorDirection;

- (void)dismiss:(BOOL)animated;

+ (instancetype)showFromView:(UIView *)fromView
                   fromPoint:(CGPoint)fromPoint
                      toView:(UIView *)toView
                    animated:(BOOL)animated
                    withText:(NSString *)text
                 buttonTitle:(NSString *)buttonTitle;

@end

Code example

// Show the tooltip.
AUPopTipView *popTipView = [AUPopTipView showFromView:button
                                            fromPoint:CGPointZero
                                               toView:self.view
                                             animated:YES
                                             withText:@"This is a tooltip."
                                          buttonTitle:@"Close"]; // If this parameter is omitted, the button on the right is not displayed.

// Hide the tooltip.
[popTipView dismiss:YES];