(iPhone/iPad开发)presentViewController相应方法在SDK5.0前后
5.0前后,对应的调用方法变了参数,而且如果用了5.0以后的方法在低版本上无法使用,而用低版本对用的方法,apple已经不提倡,现在有一种解决办法
[cpp]
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]
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self dismissModalViewControllerAnimated:YES];
}
以此类推,以后碰到类似,apple高版本sdk对低版本api不再支持时,可用类似判断解决高低版本兼容问题。
摘自 安迪·潘 的专栏
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
今日头条
更多>>您可能感兴趣的文章
- 多语言资源文件加载的一种解决方案
- iphone内关于sqlite开发的相关教程
- iphone 注册校验(正则)
- iOS 关于相机胶卷,视频库,app内部中的视频播放方法
- iOS开发那些事-iOS6苹果地图实用开发
- AddressBook.Framework应用之ABAddressBookRef,ABRecordRef,AB
- wait_fences: failed to receive reply: 10004003奇怪的错误
- iPhone开发--提交appStore审核时出现的问题
- iPhone开发学习笔记003——UITableViewCell内容自适应高度
- iphone开发之iphone解析xml&json-1