自定义GrayPageControl 在 IOS7 崩溃解决方案
来源:互联网 发布:php参考手册中文版下载 编辑:程序博客网 时间:2024/06/06 01:43
网上开源的GrayPageControl 在ios7下会崩溃,因为ios7修改了UIPageControl内部的实现
stackoverflow 中改出解决方案 注意修改红体字部分
#import "GrayPageControl.h"
@implementation GrayPageControl
-(id) initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
activeImage = [UIImage imageNamed:@"inactive_page_image"];
inactiveImage = [UIImage imageNamed:@"active_page_image"];
[self setCurrentPage:1];
return self;
}
- (id)initWithFrame:(CGRect)aFrame {
if (self = [super initWithFrame:aFrame]) {
activeImage = [UIImage imageNamed:@"inactive_page_image"];
inactiveImage = [UIImage imageNamed:@"active_page_image"];
[self setCurrentPage:1];
}
return self;
}
-(void) updateDots
{
for (int i = 0; i < [self.subviews count]; i++)
{
UIView* dotView = [self.subviews objectAtIndex:i];
UIImageView* dot = nil;
for (UIView* subview in dotView.subviews)
{
if ([subview isKindOfClass:[UIImageView class]])
{
dot = (UIImageView*)subview;
break;
}
}
if (dot == nil)
{
dot = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, dotView.frame.size.width, dotView.frame.size.height)];
[dotView addSubview:dot];
}
if (i == self.currentPage)
{
if(activeImage)
dot.image = activeImage;
}
else
{
if (inactiveImage)
dot.image = inactiveImage;
}
}
}
-(void) setCurrentPage:(NSInteger)page
{
[super setCurrentPage:page];
[self updateDots];
}
- 自定义GrayPageControl 在 IOS7 崩溃解决方案
- GrayPageControl 在 IOS7 崩溃解决方案
- URLCacher拦截url在ios7下播放视频崩溃
- uploadify在chrome下崩溃的解决方案
- webSocket在微信中崩溃的解决方案
- iOS自定义Framework调试崩溃问题的解决方案
- RFSegmentView在iOS7设备上不显示label的解决方案
- iOS7崩溃报 UIView _didChangeToFirstResponder
- 使用autolayout在iOS7系统崩溃,提示为:*** Assertion failure in -[CustomClass layoutSublayersOfLayer:]
- 自定义的UIAlertView不能在iOS7上正常显示
- 自定义的UIAlertView不能在iOS7上正常显示
- 在IOS7下自定义导航栏和状态栏
- 自定义的UIAlertView不能在iOS7上正常显示
- 19.原谅我还说iOS7,自定义转场动画与topLayoutGuide在iOS7中的bug
- uploadify 3.2 在谷歌浏览器下加载崩溃解决方案
- ios7.1 dropBox解决方案
- ios7 自定义UINavigationBar UIBarButtonItem 10px的偏移纠正的两种解决方案
- ios7 自定义UINavigationBar UIBarButtonItem 10px的偏移纠正的两种解决方案
- 拓扑排序模版
- Python操作Mysql数据库
- Metasploitable2使用指南 ----- Linux渗透
- Apache的BeanUtils的使用入门
- 最长递增子序列
- 自定义GrayPageControl 在 IOS7 崩溃解决方案
- 2014年东北地区Oracle杯
- 函数有括号与没括号的区别 -- f1与f1()的区别
- lynis—*nix安全审计工具
- Linux下配置phpMyAdmin
- C++ GUI QT 第4版 第二章 2.3(3)
- OGNL表达式和Struts2标签
- Don't mention it 与 forget it 的区别
- Xcode 5 + iOS 7免证书(iDP)真机调试与生成IPA全攻略