-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07ed1ed
commit 4078187
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,73 @@ AFDropdownNotification | |
====================== | ||
|
||
Dropdown notification view for iOS | ||
|
||
![alt text](https://raw.github.com/AlvaroFranco/AFDropdownNotification/master/img/preview.gif "Preview") | ||
|
||
##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```: | ||
|
||
```objc | ||
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: | ||
|
||
```objc | ||
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: | ||
```objc | ||
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: | ||
|
||
```objc | ||
[notification presentInView:self.view withGravityAnimation:YES]; | ||
``` | ||
Finally, to handle the buttons taps, implement the two methods defined by the delegate, ```-dropdownNotificationTopButtonTapped``` and ```-dropdownNotificationBottomButtonTapped```. | ||
```objc | ||
-(void)dropdownNotificationTopButtonTapped { | ||
NSLog(@"Top button tapped"); | ||
} | ||
-(void)dropdownNotificationBottomButtonTapped { | ||
NSLog(@"Bottom button tapped"); | ||
} | ||
``` | ||
|
||
|
||
##TODO | ||
|
||
- [ ] Light theme | ||
- [ ] Autolayout support for rotation | ||
|
||
##License | ||
AFBlurSegue 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 [[email protected]](mailto:[email protected]) |