ios 不同sdk4.3 6.0版本号,关于方法的兼容性的通用方法
生活随笔
收集整理的這篇文章主要介紹了
ios 不同sdk4.3 6.0版本号,关于方法的兼容性的通用方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
5.0前后,對應的調用方法變了參數,而且如果用了5.0以后的方法在低版本上無法使用,而用低版本對用的方法,apple已經不提倡,會有警告出現
可以采取對“執行事件”捕捉,來間接的完成兼容性
if?([self?respondsToSelector:@selector(dismissViewControllerAnimated:animated:completion:)])?{????????[self?dismissViewControllerAnimated:YES?completion:nil];//5.0+
????}
????else
????{
????????[self?dismissModalViewControllerAnimated:YES];//4.3-
????}
if?([self?respondsToSelector:@selector(presentViewController:animated:completion:)])?{
????????????[self?presentViewController:loginView?animated:YES?completion:nil];//5.0+
????????}
????????else
????????{
????????????[self?presentModalViewController:loginView?animated:YES];//4.3-
????????}
?
參考出路:http://www.2cto.com/kf/201205/133560.html
轉載于:https://www.cnblogs.com/Rampage/archive/2013/02/01/2888773.html
總結
以上是生活随笔為你收集整理的ios 不同sdk4.3 6.0版本号,关于方法的兼容性的通用方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: flash的Socket通讯沙箱和安全策
- 下一篇: C# 效率也不是很差嘛