OpinionzAlertView 0.3.1

OpinionzAlertView 0.3.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年1月

OpinionzRate 维护。




  • 作者
  • Opinionz.io

简介

美观的自定义alert视图,支持block方式。从预定义的图标中选择信息、警告、成功和错误alert。自定义颜色或设置您希望的形象。

预览

Preview

安装

手动

  1. 将OpinionzAlertView代码添加到您的项目中。

用法

注意:在视图出现后提示

示例

要运行示例项目,请克隆仓库,然后从Example目录中首先运行pod install

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

配置

设置titlemessagecancelButtonTitleotherButtonTitles

属性

OpinionzAlertView具有以下属性

@property (nonatomic, strong) UIColor *color;

Header背景颜色

@property (nonatomic, strong) UIImage *icon;

Header上的图标

@property (nonatomic, assign) OpinionzAlertIcon iconType;

或者您可以选择图标类型

typedef enum : NSUInteger {
    OpinionzAlertIconInfo = 1,
    OpinionzAlertIconWarning,
    OpinionzAlertIconSuccess,
    OpinionzAlertIconQuestion,
    OpinionzAlertIconStar,
    OpinionzAlertIconHeart
} OpinionzAlertIcon;
@property (nonatomic, assign) id<OpinionzAlertViewDelegate> delegate;

Alert视图委托

@property (nonatomic, copy) OpinionzPopupViewTapButtonBlock buttonDidTappedBlock;

Alert视图点击块

方法

OpinionzAlertView类有以下方法

- (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;

支持的操作系统和SDK版本

  • 支持的构建目标 - iOS 7.0(Xcode 6.2)

ARC兼容性

OpinionzAlertView需要ARC。

作者

Opinionz.io,[email protected]

许可证

OpinionzAlertView在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。