IOS 用UIWindow自定义AlertView(最基本代码)
来源:互联网 发布:证大财富淘宝贷容易吗 编辑:程序博客网 时间:2024/06/05 15:39
- //
- // ABCustomAlertView.h
- // KnowledgeChoice
- //
- // Created by on 13-6-19.
- // Copyright (c) 2013年 DoubleMan. All rights reserved.
- // 自定义相应的控件及代理就可以用了。。
- #import <UIKit/UIKit.h>
- @interface ABCustomAlertView : UIWindow
- // 显示
- - (void)show;
- // 消失
- - (void)dismiss;
- @end
- //
- // ABCustomAlertView.m
- // KnowledgeChoice
- //
- // Created by on 13-6-19.
- // Copyright (c) 2013年 DoubleMan. All rights reserved.
- //
- #import "ABCustomAlertView.h"
- @implementation ABCustomAlertView
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- // Initialization code
- self.windowLevel = UIWindowLevelAlert;
- // 这里,不能设置UIWindow的alpha属性,会影响里面的子view的透明度,这里我们用一张透明的图片
- // 设置背影半透明
- self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"alert_bg.png"]];
- UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 80)] autorelease];
- view.backgroundColor = [UIColor blackColor];
- view.center = CGPointMake(160, 240);
- [self addSubview:view];
- }
- return self;
- }
- - (void)show {
- [self makeKeyAndVisible];
- }
- - (void)dismiss {
- [self resignKeyWindow];
- [self release];
- }
- - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- // 点击消失
- [self dismiss];
- }
- - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- }
- - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- }
- @end
0 0
- IOS学习:用UIWindow自定义AlertView(最基本代码)
- IOS 用UIWindow自定义AlertView(最基本代码)
- 9..IOS学习:用UIWindow自定义AlertView(最基本代码)
- 【代码笔记】iOS-自定义alertView
- IOS学习笔记--利用UIWindow实现自定义AlertView
- ios 自定义alertview
- iOS自定义AlertView
- ios自定义AlertView
- iOS UIWindow基本介绍
- iOS开发之自定义AlertView
- iOS自定义alertView提示框
- 自定义AlertView(iOS7)
- ios学习之alertView的基本使用
- IOS: 自定义AlertView实现模态对话框
- [ios] alertview自定义提示信息【转】
- [IOS] 自定义AlertView实现模态对话框
- IOS: 自定义AlertView实现模态对话框
- iOS自定义alertView,继承自UIView
- java 字节流读取图片,字符流读取,二进制读取
- Python 一步一步学网络编程
- iOS: HTTPS 与自签名证书
- 嵌入式底层软件好书推荐
- 80后、90后应该这样管80后、90后应该这样管
- IOS 用UIWindow自定义AlertView(最基本代码)
- 和链表有关面试题
- iOS NSURLSession 学习(2)
- Android基本常用控件的介绍TextView EditText Button Menu
- 蓝桥杯——Anagrams问题 ,字串统计 ,矩阵乘法 ,大小写转换
- javascript:利用javascript对象的特性去掉数组中的重复项
- tt
- TCP/IP详解卷1 读书笔记:第二十三章 TCP保活定时器
- CentOS学习笔记<rz/sz安装>