Beautiful customizable alert view with blocks. Choose from predefined icons for info, warning, success and error alerts. Customize color or set your desired image.
###Cocoapods
OpinionzAlertView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'OpinionzAlertView'
###Manual
- Add the OpinionzAlertView code into your project.
NOTE: prompt it after your view did appeared
###Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
//
// ViewController.m
// Demo
//
// Created by Opinionz.io on 18/08/15.
// Copyright (c) 2015 Opinionz.io. All rights reserved.
//
#import "ViewController.h"
#import <OpinionzAlertView/OpinionzAlertView.h>
- (IBAction)buttonHandlerAlert:(id)sender {
OpinionzAlertView *alertView = [[OpinionzAlertView alloc] initWithTitle:@"Title"
message:@"message"
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
// alertView = [[OpinionzAlertView alloc] initWithTitle:@"Title"
// message:@"message"
// cancelButtonTitle:@"Cancel"
// otherButtonTitles:nil
// usingBlockWhenTapButton:^(OpinionzAlertView *alertView, NSInteger buttonIndex) {
//
// NSLog(@"Tapped button at index : %li", (long)buttonIndex);
// NSLog(@"buttonTitle: %@", [alertView buttonTitleAtIndex:buttonIndex]);
// }];
[alertView show];
}
Set title
, message
, cancelButtonTitle
and otherButtonTitles
.
The OpinionzAlertView has the following properties:
@property (nonatomic, strong) UIColor *color;
Color of header backgound
@property (nonatomic, strong) UIImage *icon;
Icon on header
@property (nonatomic, assign) OpinionzAlertIcon iconType;
Or you can choose icon type
typedef enum : NSUInteger {
OpinionzAlertIconInfo = 1,
OpinionzAlertIconWarning,
OpinionzAlertIconSuccess,
OpinionzAlertIconQuestion,
OpinionzAlertIconStar,
OpinionzAlertIconHeart
} OpinionzAlertIcon;
@property (nonatomic, assign) id<OpinionzAlertViewDelegate> delegate;
Alert view delegate
@property (nonatomic, copy) OpinionzPopupViewTapButtonBlock buttonDidTappedBlock;
Alert view tap block
The OpinionzAlertView class has following methods:
- (instancetype)initWithTitle:(NSString *)title
message:(NSString *)message
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSArray *)otherButtonTitles;
- (instancetype)initWithTitle:(NSString *)title
message:(NSString *)message
delegate:(id /*<OpinionzAlertViewDelegate>*/)delegate
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSArray *)otherButtonTitles;
- (instancetype)initWithTitle:(NSString *)title
message:(NSString *)message
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSArray *)otherButtonTitles
usingBlockWhenTapButton:(OpinionzPopupViewTapButtonBlock)tapButtonBlock;
- (void)show;
- (void)dismiss;
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
- Supported build target - iOS 7.0 (Xcode 6.2)
OpinionzAlertView requires ARC.
Opinionz.io, [email protected]
OpinionzAlertView is available under the MIT license. See the LICENSE file for more info.