iOS之自定义弹出框--AlertView
来源:互联网 发布:mysql truncate table 编辑:程序博客网 时间:2024/05/01 07:09
有时候系统的UIAlertView不一定能够满足我们的编程需求,需要我们自定义alertView,我写了一个简单的定义了界面有三种类型
效果如下所示
demo:http://download.csdn.net/detail/tuwanli125/9470335
demo地址:https://github.com/tuwanli/DefinedSelf
只需要在你的控制器里面写入提示文字:
//
// ViewController.m
// DefinedSelf
//
// Created by 涂婉丽 on 15/12/15.
// Copyright © 2015年 涂婉丽. All rights reserved.
//
#import "ViewController.h"
#import "TWLAlertView.h"
@interface ViewController ()<TWlALertviewDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
}
- (IBAction)click {
[selfloadAlertView:@"创建一个就诊号"contentStr:@"注:新建就诊号,以前的就诊信息无法查询,第一次在手机挂号到医院分诊台分诊时需要出示身份证,如果挂号填写的就诊人信息和身份证信息不符,医院有权利拒绝提供就诊服务,挂号费用不退"btnNum:2btnStrArr:[NSArrayarrayWithObjects:@"取消",@"确定",nil]type:10];
}
- (IBAction)clicktwo {
[selfloadAlertView:@"请输入密码"contentStr:nilbtnNum:2btnStrArr:[NSArrayarrayWithObjects:@"取消",@"确定",nil]type:11];
}
- (IBAction)clickThree {
[selfloadAlertView:@"常用就诊人"contentStr:@"是否删除就诊人"btnNum:1btnStrArr:[NSArrayarrayWithObject:@"退出页面"]type:12];
}
- (void)loadAlertView:(NSString *)title contentStr:(NSString *)content btnNum:(NSInteger)num btnStrArr:(NSArray *)array type:(NSInteger)typeStr
{
TWLAlertView *alertView = [[TWLAlertViewalloc]initWithFrame:CGRectMake(0,0, [UIScreenmainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
[alertViewinitWithTitle:titlecontentStr:content type:typeStr btnNum:num btntitleArr:array];
alertView.delegate =self;
UIView * keywindow = [[UIApplicationsharedApplication]keyWindow];
[keywindowaddSubview: alertView];
}
-(void)didClickButtonAtIndex:(NSUInteger)index password:(NSString *)password{
switch (index) {
case101:
NSLog(@"Click ok");
break;
case100:
NSLog(@"Click cancle");
break;
default:
break;
}
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
在TWLAlertView里面定义alertView弹出框的所有子视图,以及弹出动画
-(void)exChangeOut:(UIView *)changeOutView dur:(CFTimeInterval)dur{
CAKeyframeAnimation * animation;
animation = [CAKeyframeAnimationanimationWithKeyPath:@"transform"];
animation.duration = dur;
animation.removedOnCompletion =NO;
animation.fillMode =kCAFillModeForwards;
NSMutableArray *values = [NSMutableArrayarray];
[values addObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(0.1,0.1,1.0)]];
[values addObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.2,1.2,1.0)]];
[values addObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(0.9,0.9,0.9)]];
[values addObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0,1.0)]];
animation.values = values;
animation.timingFunction = [CAMediaTimingFunctionfunctionWithName:@"easeInEaseOut"];
[changeOutView.layeraddAnimation:animationforKey:nil];
}
- iOS之自定义弹出框--AlertView
- 随波逐流之iOS AlertView(弹出框)详解
- iOS开发之自定义AlertView
- iOS自定义alertView提示框
- 自定义弹出窗AlertView
- ios AlertView弹出框, 慢慢消失
- ios 自定义alertview
- iOS自定义AlertView
- ios自定义AlertView
- iOS之自定义AlertView的传参问题
- 【代码笔记】iOS-自定义alertView
- Swift AlertView 弹出警告框
- iOS开发之自定义弹出框
- IOS自定义弹出框
- iOS自定义弹出框
- IOS: 自定义AlertView实现模态对话框
- [ios] alertview自定义提示信息【转】
- [IOS] 自定义AlertView实现模态对话框
- LintCode:把排序数组转换为高度最小的二叉搜索树
- iOS GitHub上值得留意的第三方库
- 分布式搜索Elasticsearch——概述
- 设置启动图片
- LeetCode 26:Remove Duplicates from Sorted Array
- iOS之自定义弹出框--AlertView
- 常用的正则表达式
- UIWebView设置字体大小,颜色,字体
- Python单元测试框架之Nose
- alsa的 snd_pcm_readi 和 snd_pcm_writei
- js - 下雪动态效果-setInterval、animate
- Drools 入门例子
- 常用工具类
- Akka介绍(Akka 1)