Skip to content

creantan/AFDropdownNotification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AFDropdownNotification

Dropdown notification view for iOS

alt text

##Installation

If you're using CocoaPods, just add this line to your Podfile:

pod 'AFDropdownNotification', '~> 1.0'

If you're not, import these files to your project:

AFDropdownNotification.h
AFDropdownNotification.m

##Usage

First of all, init your AFDropdownNotification class and set your main class as AFDropdownNotificationDelegate:

AFDropdownNotification *notification = [[AFDropdownNotification alloc] init];
notification.notificationDelegate = self;

You can configure the title text with the titleText property, the subtitle text with subtitleText, an optional left image defined as image, and two optional buttons, with topButtonText and bottomButtonText. For example:

notification.titleText = @"Update available";
notification.subtitleText = @"Do you want to download the update of this file?";
notification.image = [UIImage imageNamed:@"update"];
notification.topButtonText = @"Accept";
notification.bottomButtonText = @"Cancel";

If you want to hide the notification by tapping it, set dimissOnTap to YES:

notification.dismissOnTap = YES;

To present it, you can choose if you want to use UIKit dynamics (which will include a subtle bounce) or a regular lineal UIKit animation:

[notification presentInView:self.view withGravityAnimation:YES];

Finally, to handle the buttons taps, implement the two methods defined by the delegate, -dropdownNotificationTopButtonTapped and -dropdownNotificationBottomButtonTapped.

-(void)dropdownNotificationTopButtonTapped {
 
    NSLog(@"Top button tapped");
}

-(void)dropdownNotificationBottomButtonTapped {

    NSLog(@"Bottom button tapped");
}

##TODO

  • Light theme
  • Autolayout support for rotation

##License AFDropdownNotification is under MIT license so feel free to use it!

##Author Made by Alvaro Franco. If you have any question, feel free to drop me a line at alvarofrancoayala@gmail.com

About

Dropdown notification view for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 96.8%
  • Ruby 3.2%