• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Beautiful customizable alert view with blocks

OpinionzAlertView

CI Status Version License Platform

Introduction

Beautiful customizable alert view with blocks. Choose from predefined icons for info, warning, success and error alerts. Customize color or set your desired image.

Preview

Preview

Installation

###Cocoapods

OpinionzAlertView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'OpinionzAlertView'

###Manual

  1. Add the OpinionzAlertView code into your project.

Usage

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];
}

Configuration

Set title, message, cancelButtonTitle and otherButtonTitles.

Properties

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

Methods

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 OS & SDK Versions

  • Supported build target - iOS 7.0 (Xcode 6.2)

ARC Compatibility

OpinionzAlertView requires ARC.

Author

Opinionz.io, [email protected]

License

OpinionzAlertView is available under the MIT license. See the LICENSE file for more info.