Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A visual component for iOS to present a dynamically sized, non-invasive notification to the user.
Objective-C Ruby
tag: 1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
NoticeView.xcodeproj
NoticeView
NoticeViewiPad
Screenshots
.gitignore
LICENSE
NoticeView.podspec
README.md

README.md

NoticeView

A visual component to present a dynamically sized, non-invasive notification to the user.

Based off of tciuro/NoticeView

Installing

If you're using CocoPods it's as simple as:

pod 'NoticeView', :git => 'https://github.com/levigroker/NoticeView.git'

Documentation

+ (WBNoticeView *)noticeOfType:(WBNoticeType)noticeType
                        inView:(UIView *)view
                         title:(NSString *)title
                       message:(NSString *)message
                      duration:(NSTimeInterval)duration
                dismissedBlock:(WBNoticeViewDismissedBlock)dismissedBlock;

WBNoticeType

  • WBNoticeTypeError

Displays a red notification with alert icon

  • WBNoticeTypeSuccess

Displays a red notification with alert icon

  • WBNoticeTypeSticky

Displays a grey notification with up arrow icon

Examples

Displays an "error" notification which will be displayed on the screen for kErrorAlertNotificationDisplayTime (a constant you define):

WBNoticeView *notice = [WBNoticeView noticeOfType:WBNoticeTypeError inView:self.view title:NSLocalizedString(@"That didn’t work.", nil) message:NSLocalizedString(@"Whatever you just did didn't work. Please try again.", nil) duration:kErrorAlertNotificationDisplayTime dismissedBlock:nil];
[notice show];

Displays a "success" notification for one and a half seconds, or is dismissed by the user, and provides a block to get executed when the notification is dismissed:

WBNoticeView *notice = [WBNoticeView noticeOfType:WBNoticeTypeSuccess inView:self.view title:@"7 New Tweets arrived somewhere from the intertubes." message:nil duration:1.5f dismissedBlock:^(BOOL userDismissed) {
    NSLog(@"User did%@ dismiss the notification.", userDismissed ? @"" : @" not");
}];
[notice show];
Something went wrong with that request. Please try again.