RGLAlertView
RGLAlertView copied to clipboard
A new way to create custom alert views.
RGLAlertView
A nicely alternative way to present alert views, add colors, text, customize them with images, and everything as easy as including a string.
Featuring
- As easy as entering a string.
- For all devices, calculated sizes dinamically.
- With multiple animations to present the alert.
- Know which button is tapped.
- Add up to 3 buttons in an alert.
- Add images to customize it more.
Usage
Import the main file into your Xcode project and import it in the view controller you want the view to appear:
#import "RGLAlertView.h"
In the view you want, instantiate the view, and present it.
Create a simple alert
RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view presentAlertViewWithAnimation:0];
Add more stuff into the alert
RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view setBody:@"This is some random text, funny thing about it is that, based in my size, the alert is going to get bigger and bigger!"];
[view addButtonWithTitle:@"Touch"];
[view addImageInTop:[UIImage imageNamed:@"firstImage"]];
[view presentAlertViewWithAnimation:0];
Use the delegate
With the delegate you're going to be able to know which button is getting tapped. Is that easy:
view.delegate = self;
And then call the methods
- (void)buttonDidPressedWithTitle:(NSString *)string
{
NSLog(@"%@", string);
}
- (void)buttonDismissDidPressed
{
}
Example
Upcoming features
- TextField support, you're going to be able to listen to some methods once you are typing.
- Adding custom fonts into the alert view.
- More customization (ideas?).
Contributing
- Fork it.
- Create your branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Added this feature'
). - Push to the branch (
git push origin feature-branch
). - Create new pull request.
Done by
Ramon Gilabert with love! :)