UIAlertView扩展

//
//  UIAlertView+Extentsion.h
//  CloudShopping
//
//  Created by sixiaobo on 14-7-8.
//  Copyright (c) 2014年 com.Uni2uni. All rights reserved.
//

#import <UIKit/UIKit.h>

/*!
 * @brief UIAlertView扩展类,用于提供更加简化的方式来调用显示UIAlertView
 * @author huangyibiao
 */
@interface UIAlertView (Extentsion)

/*!
 * @brief 默认会带有确定和取消按钮
 * @param message 标题
 */
+ (void)showWithMessage:(NSString *)message;

/*!
 * @brief 默认会带有确定和取消按钮,需要标题和内容参数
 * @param title 标题
 * @param message 内容
 */
+ (void)showWithTitle:(NSString *)title message:(NSString *)message;

/*!
 * @brief 默认会带有确定和取消按钮,需要标题和内容参数
 * @param title 标题
 * @param message 内容
 * @param delegate 代理
 */
+ (void)showWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate;

/*!
 * @brief 需要标题和内容参数,确定和取消按钮标题
 * @param title 标题
 * @param message 内容
 * @param okButtonTitle 确定标题
 */
+ (void)showWithTitle:(NSString *)title
              message:(NSString *)message
             okButton:(NSString *)okButtonTitle
         cancelButton:(NSString *)cancelButtonTitle;

/*!
 * @brief 需要标题和内容参数,代理,确定和取消按钮标题
 * @param title 标题
 * @param message 内容
 * @param delegate 代理
 */
+ (void)showWithTitle:(NSString *)title
              message:(NSString *)message
             delegate:(id)delegate
             okButton:(NSString *)okButtonTitle
         cancelButton:(NSString *)cancelButtonTitle;



@end


//
//  UIAlertView+Extentsion.m
//  CloudShopping
//
//  Created by sixiaobo on 14-7-8.
//  Copyright (c) 2014年 com.Uni2uni. All rights reserved.
//

#import "UIAlertView+Extentsion.h"

#define kOkButtonDefaultTitle     @"确定"
#define kCancelButtonDefaultTitle @"取消"

@implementation UIAlertView (Extentsion)

+ (void)showWithMessage:(NSString *)message {
    [self showWithTitle:nil message:message];
    return;
}

+ (void)showWithTitle:(NSString *)title message:(NSString *)message {
    [self showWithTitle:title message:message delegate:nil];
    return;
}

+ (void)showWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate {
    [self showWithTitle:title
                message:message
               okButton:kOkButtonDefaultTitle
           cancelButton:kCancelButtonDefaultTitle];
    return;
}

+ (void)showWithTitle:(NSString *)title
              message:(NSString *)message
             okButton:(NSString *)okButtonTitle
         cancelButton:(NSString *)cancelButtonTitle {
    [self showWithTitle:title
                message:message
               delegate:nil
               okButton:okButtonTitle
           cancelButton:cancelButtonTitle];
    return;
}

+ (void)showWithTitle:(NSString *)title
              message:(NSString *)message
             delegate:(id)delegate
             okButton:(NSString *)okButtonTitle
         cancelButton:(NSString *)cancelButtonTitle {
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                        message:message
                                                       delegate:delegate
                                              cancelButtonTitle:cancelButtonTitle
                                              otherButtonTitles:okButtonTitle, nil];
    [alertView show];
    return;
}



@end


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值