IOS 7 自定义的UIAlertView不能在iOS7上正常显示
2013-11-29 09:37
423 查看
本文转载至 http://blog.csdn.net/hanbing861210/article/details/13614405
众所周知,当伟大的iOS7系统发布后,表扬的一堆、谩骂的也一片,而对于我们程序员来说最关心的莫过于低版本系统上的程序在搞版本系统上的兼容性问题了。
在iOS6.1几之前,当我们想要做一些提醒用户或临时获取一些数据时,通常会弹出一个模态试图,给予用户提醒,而最常见的做法莫过于直接用UIAlertView添加控件或继承UIAlertView,然后添加自己想要的控件,如:在执行网络连接 下载等耗时任务时我们会弹出一个view 然后显示一个指示器,具体做法:
但上面的做法到了iOS7上就没有用了 ,你自己所添加的控件根本显示不出来,也就是说在iOS7上不允许我们更改系统的UIAlertView了(至少目前是这样2013/07/18 beta3版本),我想大家肯定也遇到了这样的问题,那现在改怎么半呢? 可以采用UIWindow的方式实现具体做法网上很多,我比较懒 随便写了点
对于UIWindow的相关东西可以参考 http://www.cnblogs.com/smileEvday/archive/2012/03/27/2420362.html#2728097
注意设计到UIWindow显示的工程不能用arc ,具体原因还没找到让我信服的 ,希望知道的大牛可以回复下。。。。。。。
众所周知,当伟大的iOS7系统发布后,表扬的一堆、谩骂的也一片,而对于我们程序员来说最关心的莫过于低版本系统上的程序在搞版本系统上的兼容性问题了。
在iOS6.1几之前,当我们想要做一些提醒用户或临时获取一些数据时,通常会弹出一个模态试图,给予用户提醒,而最常见的做法莫过于直接用UIAlertView添加控件或继承UIAlertView,然后添加自己想要的控件,如:在执行网络连接 下载等耗时任务时我们会弹出一个view 然后显示一个指示器,具体做法:
// // ViewController.m // AlertDemo // // Created by PSH_Chen_Tao on 7/19/13. // Copyright (c) 2013 wolfman. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize indicator; @synthesize customeAlertView; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)showTraditionAlert:(id)sender { UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"正在下载....." message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil]; alertView.delegate = self; [alertView show]; } - (IBAction)showWindowAlert:(id)sender { customeAlertView = [[CustomeAlertView alloc]init]; customeAlertView.delegate = self; [customeAlertView show]; } #pragma mark -- UIAlertViewDelegate //实现代理增加网络指示器 - (void)willPresentAlertView:(UIAlertView *)alertView;{ indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; indicator.frame = CGRectMake(110, 20, 50, 50); [alertView addSubview:indicator]; [indicator startAnimating]; [indicator release]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ [indicator stopAnimating]; } #pragma mark -- CustomeAlertViewDelegate -(void)CustomeAlertViewDismiss:(CustomeAlertView *) alertView{ [alertView release]; NSLog(@"CustomeAlertViewDismiss"); } @end
对于UIWindow的相关东西可以参考 http://www.cnblogs.com/smileEvday/archive/2012/03/27/2420362.html#2728097
注意设计到UIWindow显示的工程不能用arc ,具体原因还没找到让我信服的 ,希望知道的大牛可以回复下。。。。。。。
相关文章推荐
- IOS 7 自定义的UIAlertView不能在iOS7上正常显示
- 自定义的UIAlertView不能在iOS7上正常显示
- 自定义的UIAlertView不能在iOS7上正常显示
- 自定义的UIAlertView不能在iOS7上正常显示
- 自定义的UIAlertView不能在iOS7上正常显示
- iOS开发笔记-ios7 UIAlertView自定义
- iOS开发-ios7 UIAlertView自定义
- UIAlertView message 居左对齐 显示ios7以后不能用的启发
- 使用原生自定义View,setState刷新界面后UI不能正常显示
- IOS开发系列--TableView、多个TableViewCell、自定义Cell、Cell上画画(故事板+代码方式),ios7tableview索引
- 自定义ios UIAlertView, 重排按钮位置
- iOS开发 自定义tableView样式(使用代码/使用Interface Builder)、分组显示、给TableView增加索引、给TableView增加SearchBar
- Android 6.0以上 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题
- IOS】自定义UIAlertView样式,实现可替换背景和按钮 此博文包含图片此博文包含视频 (2012-10-24 10:23:25)
- UIAlertView中显示进度条 ios iphone xcode
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题。
- 关于JKAlertDialog在多个视图控制器跳转后不能正常显示的问题的解决--IOS
- 【Android】WebView加载https页面不能正常显示资源问题
- react-native 在iOS上使用http链接的图片地址不显示| iOS9 & iOS10 HTTP 不能正常使用的解决办法
- IOS SDK百度地图不能正常显示,只显示网格