Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions NoticeView/WBNoticeView/WBNoticeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ typedef enum WBNoticeViewSlidingMode {
*/
@property (nonatomic, readwrite, getter = isFloating) BOOL floating;

/**
*
* A boolean value that represents whether or not the current notice view is visible on screen or not.
* Easy way to prevent multiple notices being shown at once is to check this property. :)
*
*/
@property(nonatomic, readonly) BOOL currentlyDisplayed;

///----------------------------------------
/// @name Showing and Dismissing the Notice
///----------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions NoticeView/WBNoticeView/WBNoticeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ @implementation WBNoticeView
@synthesize dismissalBlock = _dismissalBlock;
@synthesize dismissalBlockWithOptionalDismiss = _dismissalBlockWithOptionalDismiss;
@synthesize floating = _floating;
@synthesize currentlyDisplayed = _currentlyDisplayed;

- (id)initWithView:(UIView *)view title:(NSString *)title
{
Expand All @@ -62,6 +63,7 @@ - (id)initWithView:(UIView *)view title:(NSString *)title
_tapToDismissEnabled = YES;
_slidingMode = WBNoticeViewSlidingModeDown;
_floating = NO;
_currentlyDisplayed = NO;
_contentInset = UIEdgeInsetsMake(0,0,0,0); // No insets as default
}
return self;
Expand Down Expand Up @@ -104,7 +106,9 @@ - (void)displayNotice
{
self.gradientView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth;
}


_currentlyDisplayed = YES;

// Go ahead, display it
[UIView animateWithDuration:self.duration animations:^ {
CGRect newFrame = self.gradientView.frame;
Expand Down Expand Up @@ -152,7 +156,7 @@ - (void)dismissNoticeWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval
BOOL dismissAfterBlock = YES;
self.dismissalBlockWithOptionalDismiss(NO, &dismissAfterBlock);
}

_currentlyDisplayed = NO;
// Cleanup
[self cleanup];
}];
Expand Down