代码库> 弹出视图> PXAlertView——可用来替代UIAlertView,iOS7风格。可自行定制
PXAlertView——可用来替代UIAlertView,iOS7风格。可自行定制
关注
上传者:ccsupport 分类:弹出视图(Popup View)
查看次数:11213 下载次数:1368
上传时间:2013-10-18 大小:406 B
PXAlertView可以用来替代UIAlertView ,它采用的是iOS 7的风格,拥有基于block的API,它还可以自己定制UI风格以及增加定制的views。


效果图:

特色
使用简单的block syntax来取代delegates
适合iOS 7de UIAlertView的动画
可以任意定制
可以在title的底部增加自己的UIView

安装
将下行加入CocoaPods的Podfile
pod 'PXAlertView', '~> 0.0.2'
或者复制附件中的PXAlertView.h和.m文件到工程中去。

使用方法
查看PXAlertView.h文件获取完整的API。如下:


//
//  PXAlertView.h
//  PXAlertViewDemo
//
//  Created by Alex Jarvis on 25/09/2013.
//  Copyright (c) 2013 Panaxiom Ltd. All rights reserved.
//


@import UIKit;


@interface PXAlertView : UIView


@property (nonatomic, getter = isVisible) BOOL visible;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title
                            message:(NSString *)message;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title
                            message:(NSString *)message
                         completion:(void(^) (BOOL cancelled))completion;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title
                            message:(NSString *)message
                        cancelTitle:(NSString *)cancelTitle
                         completion:(void(^) (BOOL cancelled))completion;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title
                            message:(NSString *)message
                        cancelTitle:(NSString *)cancelTitle
                         otherTitle:(NSString *)otherTitle
                         completion:(void(^) (BOOL cancelled))completion;


+ (PXAlertView *)showAlertWithTitle:(NSString *)title
                            message:(NSString *)message
                        cancelTitle:(NSString *)cancelTitle
                         otherTitle:(NSString *)otherTitle
                        contentView:(UIView *)view
                         completion:(void(^) (BOOL cancelled))completion;


@end





例子:




[PXAlertView showAlertWithTitle:@"The Matrix"
                        message:@"Pick the Red pill, or the blue pill"
                    cancelTitle:@"Blue"
                     otherTitle:@"Red"
                     completion:^(BOOL cancelled) {
                         if (cancelled) {
                             NSLog(@"Cancel (Blue) button pressed");
                         } else {
                             NSLog(@"Other (Red) button pressed");
                         }
                     }];



特色
iOS 7风格
支持动态指定 AlertView: default/dark的风格
支持增加多个按钮


下载附件:
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部