(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不再支持时,可用类似判断解决高低版本兼容问题。
摘自 安迪·潘 的专栏
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
今日头条
更多>>您可能感兴趣的文章
- Android:实现TabWidget选项卡按钮在屏幕下方
- iPhone应用开发之十一:常用的三种动画表现效果
- Lexical or Preprocessor Issue 'xxx.h
- iPhone开发学习笔记006—— NSNotification自定义通知名
- ios学习笔记(二)xcode 4.3.2下实现基本交互
- Memory on the iPhone
- iphone开发之object c基础一定义接口
- (iPhone/iPad开发)presentViewController相应方法在SDK5.0前后
- ios开发问题:添加库和复制其它工程文件编译错误问题
- 多线程之NSInvocationOperation