zoukankan      html  css  js  c++  java
  • UIAlertView

    //
    //  UIAlertView+Extention.h
    //
    //  Created by jzl on 15/3/13.
    //  Copyright (c) 2015年 JZL. 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+Extention.m
    //
    //  Created by jzl on 15/3/13.
    //  Copyright (c) 2015年 JZL. All rights reserved.
    //

    #import "UIAlertView+Extension.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

  • 相关阅读:
    消息中间件与kafka(二)
    维度建模基本概念(二)
    阿里开源canal
    ETL-kettle报错--org.gjt.mm.mysql.Driver
    消息中间件与rabbitmq(一)
    python装饰器--这个很pythonic
    Swift开发小技巧--识别选中照片中的二维码
    Swift开发小技巧--扫描二维码,二维码的描边与锁定,设置扫描范围,二维码的生成(高清,无码,你懂得!)
    Swift开发小技巧--自定义转场动画
    Swift基础--通知,代理和block的使用抉择以及Swift中的代理
  • 原文地址:https://www.cnblogs.com/jzlblog/p/4342503.html
Copyright © 2011-2022 走看看