下iOS5 和iOS 4.3版本的函数差异 …
2013-08-19 18:22
288 查看
最好的方法还是查看下iOS5
和iOS 4.3版本的函数差异表。提前预防下,对于diffrent
function进行判断下。由于比较多,就不罗列了。转载别人写好的一个。
5.0前后,对应的调用方法变了参数,而且如果用了5.0以后的方法在低版本上无法使用,而用低版本对用的方法,apple已经不提倡,现在有一种解决办法
[cpp] view
plaincopy
AboutViewController *mAboutViewController = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) {
[self.navigationController presentViewController:mAboutViewController animated:YES completion:nil];
}else{
[self.navigationController presentModalViewController:mAboutViewController animated:YES];
}
[mAboutViewController release];
mAboutViewController = nil;
在调用时判断一下
同理,dismiss时也是类似操作
[cpp] view
plaincopy
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self dismissModalViewControllerAnimated:YES];
}
以此类推,以后碰到类似,apple高版本sdk对低版本api不再支持时,可用类似判断解决高低版本兼容问题。
和iOS 4.3版本的函数差异表。提前预防下,对于diffrent
function进行判断下。由于比较多,就不罗列了。转载别人写好的一个。
5.0前后,对应的调用方法变了参数,而且如果用了5.0以后的方法在低版本上无法使用,而用低版本对用的方法,apple已经不提倡,现在有一种解决办法
[cpp] view
plaincopy
AboutViewController *mAboutViewController = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) {
[self.navigationController presentViewController:mAboutViewController animated:YES completion:nil];
}else{
[self.navigationController presentModalViewController:mAboutViewController animated:YES];
}
[mAboutViewController release];
mAboutViewController = nil;
在调用时判断一下
同理,dismiss时也是类似操作
[cpp] view
plaincopy
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self dismissModalViewControllerAnimated:YES];
}
以此类推,以后碰到类似,apple高版本sdk对低版本api不再支持时,可用类似判断解决高低版本兼容问题。
相关文章推荐
- iOS 检测版本更新
- iOS 不同版本不同行为的另一种宝法
- iOS&Xcode各版本差异(一) --iOS6与iOS7
- arcgis api for IOS版本更新
- ios math.h 常用数学函数
- 如何查看linux版本 如何查看LINUX…
- ios 视图间的关系
- ios开发--app 同时支持iphon…
- iOS APP设计规范大全
- MATLAB fgoalattain()函数 解…
- Android JDK 的下载版本
- mysql 的 my.ini配置有变化(版本5.…
- iOS 获取手机码时间倒计时(定…
- MySQL 函数
- IOS 启动页面制作
- iOS App进入后台获取更…
- ios/oc 快递查询代码
- Oracle PL/SQL过程与函数hell…
- [2014-03-25]iOS NSString、…
- (转)iOS UIControl 几个事件的说明