本文介绍了setNeedsStatusBarAppearance更新无法识别的选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我的iOS phonegap应用程序的状态栏重叠的Web视图在iOS 7.我发现这个答案修正了问题,但第二步,调用
I had an issue with my iOS phonegap app having the status bar overlap the webview in iOS 7. I found this answer which fixed the problem, but the second step, calling
[self setNeedsStatusBarAppearanceUpdate];
会导致应用程序崩溃iOS 6并引发无法识别的选择器
in viewDidLoad
causes the app to crash in iOS 6 and throw unrecognized selector
.
推荐答案
您需要使用iOS 7中的某些东西,例如 setNeedsStatusBarAppearanceUpdate
,并且您仍需要支持早期的iOS版本,您可以先检查选择器是否受支持:
In the future, if you ever need to use something from iOS 7, such as setNeedsStatusBarAppearanceUpdate
and you need to still support earlier iOS versions, you can first check if the selector is supported:
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
{
[self setNeedsStatusBarAppearanceUpdate];
}
这篇关于setNeedsStatusBarAppearance更新无法识别的选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!