From a65621a45682a1e826f3af45bd3a02bbea2f4149 Mon Sep 17 00:00:00 2001 From: Ian Spence Date: Fri, 13 Nov 2015 21:45:18 -0800 Subject: [PATCH] Adds "hideAfter" property to hide tip after n seconds --- CMPopTipView/CMPopTipView.h | 1 + CMPopTipView/CMPopTipView.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CMPopTipView/CMPopTipView.h b/CMPopTipView/CMPopTipView.h index 1e413bd..5c3e855 100644 --- a/CMPopTipView/CMPopTipView.h +++ b/CMPopTipView/CMPopTipView.h @@ -133,6 +133,7 @@ typedef NS_ENUM(NSInteger, CMPopTipAnimation) { @property (nonatomic, assign) CGFloat pointerSize; @property (nonatomic, assign) CGFloat bubblePaddingX; @property (nonatomic, assign) CGFloat bubblePaddingY; +@property (nonatomic, assign) NSTimeInterval hideAfter; /* Contents can be either a message or a UIView */ - (id)initWithTitle:(NSString *)titleToShow message:(NSString *)messageToShow; diff --git a/CMPopTipView/CMPopTipView.m b/CMPopTipView/CMPopTipView.m index 83f2dfb..93330f4 100644 --- a/CMPopTipView/CMPopTipView.m +++ b/CMPopTipView/CMPopTipView.m @@ -346,6 +346,10 @@ - (void)drawRect:(__unused CGRect)rect #pragma clang diagnostic pop } + + if (self.hideAfter) { + [self performSelector:@selector(dismissByUser) withObject:nil afterDelay:self.hideAfter]; + } } }