IOS8系统下,APP开发的不同,及碰到的问题收集
来源:互联网 发布:日本文学 知乎 编辑:程序博客网 时间:2024/06/05 05:31
如题:IOS8正式版发布后,原来的项目很多,都出现了各种各样的问题。
正如苹果官方所说,IOS8,对于开发者来说会有很大的变化
这里做个收集,目前只碰到几个。记录一下:
1.UITableviewCell
内存不断增加。找了很久原因。后来一步一步的寻下去,发现是以下问题
- (void)layoutSubviews
之前,因为IOS7设置了accessoryView后,contentView回被向前移动。为了让contentView位置不变,所以在该方法中,使用了[super layoutSubviews]; // IOS8 开始,会引起循环。所以只在IOS8以前执行if (need) { CGRect frmContentview = self.contentView.frame; frmContentview.size.width = CGRectGetWidth(self.bounds); self.contentView.frame = frmContentview; }所以很多使用这个的地方都会引起无限循环。因为改变了contentView的frame就会不断引起layoutSubviews方法。
解决方法:使用了self.contentView.superView。并且在
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{ [super setSelected:selected animated:animated]; [self.contentView.superView setBackgroundColor:self.contentView.backgroundColor]; // Configure the view for the selected state}- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ [super setHighlighted:highlighted animated:animated]; [self.contentView.superView setBackgroundColor:self.contentView.backgroundColor];}
这样颜色就比较统一了。其他的正常使用就可以了。
2.NSUserDefaults
这个东西真的很蛋疼。clean下项目,删除模拟器APP。重新运行后,
发现取到的BOOL值或都其他,基本都跟未删除时一样。经过google,最终找到IOS8的模拟器,如果删除了app,貌似NSUserDefaults是不会重置的。
所以,只有重新reset下模拟器。重试后发现,还真的是这么回事。真机还没有测试。
3.键盘。
不管是textField还是textView都可以看到光标在跳动。但是键盘就是不出来。
纠结了了1个多小时,找各种原因,google了很久。最后,在第2点重置后发现,恢复正常。瞬间无语
4.UIAlertView
UIAlertView如果设置title为nil。会发现字体变黑,设为@""就可以了
5.重名问题
新建了一个类继承自NSObject。并且声明了一个delegate的protocol。
结果,在使用的时候发现指向了NSFileManagerDelegate。
这个是因为在IOS8的SDK中,NSObject类存在一个delegate的声明。重名就改名,解决
6.UIScrollview
很多人在IOS6升级IOS7的时候应该碰到过UIScrollview不能滑动的问题。网上的方法都是这样的在viewWillAppear 或者 viewDidAppear 中加入,
[self.tableview setContentOffset:CGPointMake(0, CGFLOAT_MAX) animated:YES];
但是在IOS8里面,发现这种话,也会引起界面卡死所以大家可以使用以下方法解决
if (self.tableview.contentSize.height > self.tableview.bounds.size.height) { [self.tableview setContentOffset:CGPointMake(0, self.tableview.contentSize.height) animated:YES]; }
7.BadgeNumber
更新APP徽标的时候,在IOS8中需要授权,否则可能出错。或提示
Attempting to badge the application icon but haven't received permission from the user to badge the application
#ifdef SUPPORT_IOS8 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { UIUserNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:myTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; }else#endif { UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound; [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes]; }
#define SUPPORT—IOS8 1
__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
============================================其他碰到慢慢补充================================================这里有一个说IOS8变化的贴子,大家可以看一下:
http://www.cocoachina.com/bbs/read.php?tid-217107.html
- IOS8系统下,APP开发的不同,及碰到的问题收集
- IOS8系统下APP开发的不同及碰到的问题收集
- ios7与ios8系统版本不同出现的问题积累
- iOS8 下企业版App无法正常升级的问题
- 记录下 初次接触驱动开发的过程 及碰到的问题
- 学习djangorestframework碰到的小问题收集
- iOS8下的开发变化
- iOS8下的开发变化
- iOS8下的开发变化
- iOS8下的开发变化
- iOS8下的开发变化
- iOS8下的开发变化
- iOS8下的开发变化
- 我开发一个jsp系统时碰到的问题
- Ubuntu下安装sunpinyin碰到的问题及解决办法
- Ubuntu下安装sunpinyin碰到的问题及解决办法
- linux下一些碰到的问题及解决办法
- android 编译碰到的问题及解决办法:(ubuntu下编译)
- Git:一分钟学会简单使用
- Linux企业级开发技术(1)——epoll企业级开发之简介
- 北斗的投资哲学、投资理念及投资策略
- thymeleaf例子
- HDU 2845 Beans
- IOS8系统下,APP开发的不同,及碰到的问题收集
- Maven配置本地库加载ojdbc14-10.2.0.4.0.jar文件
- Linux 静态库&动态库调用
- 【Java.JMS】点对点通信——Queue
- Android 3.0 r1中文API文档(103) —— InputMethodManager [输入法]
- android完全退出应用程序
- PHP格式化输出json数据
- 通过Web打启动本地应用程序(一)
- 数据结构之顺序栈