我用这个代码
#define IS_IOS7 (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1)
Run Code Online (Sandbox Code Playgroud)
查找应用程序是否在iOS7上运行.但我现在需要知道它是否在iOS7.1上运行但是没有任何NSFoundationVersionNumber_iOS_7_0和NSFoundationVersionNumber_iOS_7_1
我知道的定义
#define NSFoundationVersionNumber_iOS_6_1 993.00
Run Code Online (Sandbox Code Playgroud)
所以也许我可以与高于993的数字进行比较,但我不知道.有人得到安全可靠的解决方案吗?
我有一个UIWebView,我想把它放在半透明的UINavigationBar下面.通常,当我将UIScrollView置于半透明的UINavigationBar下时,我设置了它的contentOffset,以便所有内容最初都会在条形图之后被推送,以便可以看到它; 此后,用户可以滚动文本,它将重叠条.
问题是UIWebView似乎不是UIScrollView的合适子类; 因此,我不能使用setContentOffset.有没有人有任何提示或技巧让UIWebView看起来很好用半透明的导航栏?谢谢.
只是想知道我可以检查设备(iPhone,iPad,iPod,即iOS设备)是否有陀螺仪?
在我的AppDelegate中,我使用外观代理来制作自定义UI:
//Setup custom appearances
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"header"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"header"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
这将在iOS4中崩溃.如何检查这个功能是否在他们运行的iOS版本上可用,这样我可以避免崩溃?
可能重复:
我们如何以编程方式检测运行设备的iOS版本?
如何检查设备是否运行iOS 6?我需要检查操作系统是否是iOS 6,以便更改我的YouTube视频网址,因为Apple发布了关于如何在iOS6中处理它们的说明
从iOS 6开始,http://www.youtube.com/watch?v= oHg5SJYRHA0形式的嵌入式YouTube网址 将不再有效.这些网址用于在YouTube网站上查看视频,而不是用于嵌入网页.相反,应使用的格式在 https://developers.google.com/youtube/player_parameters中介绍.
我在想一个if else语句来处理这个问题.
谢谢你的帮助
我正在建立一个黑暗的主题iOS 6和7应用程序.我知道我可以打电话[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];让iOS 7状态栏适合深色主题应用程序.
问题是我要将我的应用程序提交到App Store,目前Xcode 5尚未准备就绪,所以我必须使用Xcode 4.6.x来完成这项任务.但是使用Xcode 4.6,我无法从iOS 7编译新方法.我想我必须做一些像""如果ios7""那么做[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];并重新定位我的应用程序窗口.
我试图用这样做#ifdef... #else...此代码是[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];内部的viewDidLoad.
任何人都可以帮助理解如何使用#ifdef...在某些函数中的方法.
非常感谢!!!!
dismissModalViewControllerAnimated不推荐使用:首先在iOS6.0中弃用
Xcode是5.1.我想获得当前用户设备的操作系统版本,以便在后端进行一些分析.我想尝试如下,
[[[UIDevice currentDevice] systemVersion] floatValue]; **//not returning the minor version number**
Run Code Online (Sandbox Code Playgroud)
当我在拥有iOS 8.0.2的iPhone上运行测试时,这个api返回8.000000作为结果,但我需要的是8.0.2的确切iOS版本
提前了解任何有关解决此问题的帮助.
在过去,我使用以下预处理器代码有条件地执行不同iOS版本的代码:
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
// target is iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000
// target is lower than iOS 6.0
#else
// target is at least iOS 6.0
#endif
#endif
Run Code Online (Sandbox Code Playgroud)
但是对于iOS 7,我有以下问题:
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
// target is iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000
// target is lower than iOS 7.0
NSLog(@"This message should only appear if iOS version is 6.x or lower");
#else
// target is at least iOS 7.0
#endif
#endif
Run Code Online (Sandbox Code Playgroud)
NSLog上面的消息显示在iOS 7下的控制台上.我做错了吗?
编辑:以下代码在iOS 7下运行(模拟器和设备)
NSLog(@"Version %i", __IPHONE_OS_VERSION_MIN_REQUIRED);
Run Code Online (Sandbox Code Playgroud)
给出:版本60000
我正在使用Appirater(https://github.com/arashpayan/appirater)在我的xcode项目中启用应用程序评级.使用"iOS模拟器"时,一切都建立正常,但当我使用"iOS设备"目标存档我的项目时,我得到2个构建错误:
语义问题:函数'SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO'的隐式声明在C99中无效
语义问题:函数'SYSTEM_VERSION_LESS_THAN'的隐式声明在C99中无效
相关的代码行位于Appirater.m文件中:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") && SYSTEM_VERSION_LESS_THAN(@"7.1")) {
reviewURL = [templateReviewURLiOS7 stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", _appId]];
}
Run Code Online (Sandbox Code Playgroud)
任何援助将不胜感激.
ios ×7
objective-c ×6
iphone ×5
cocoa-touch ×2
xcode ×2
appearance ×1
appirater ×1
gyroscope ×1
ifdefine ×1
ios6 ×1
ios7 ×1
ios7.1 ×1
ipad ×1
sdk ×1