我只是将我的Xcode更新为5.我正在尝试构建我的应用程序,它在iOS7上看起来非常好,但我的工具栏有问题.工具栏上的按钮非常靠近状态栏.如果你做了一些改变,那么它打破了iOS 5和6的用户界面.最好的方法是什么?为iOS 7构建不同的故事板被认为是一种好方法吗?有没有其他方法可以解决工具栏的问题?
最佳方法是在进行任何更改之前向iOS版本添加大量检查.将以下宏放在*_prefix.pch文件中
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
Run Code Online (Sandbox Code Playgroud)
然后使用这样的iOS 7特定功能:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
self.automaticallyAdjustsScrollViewInsets = YES;
// or anything. Above line not specific to question, just an example
}
Run Code Online (Sandbox Code Playgroud)
在Xcode 5 Interface Builder中,您还可以在Size Inspector(Utilities(第三个)列中的第四个选项卡)中指定iOS 7和6或更低版本之间的偏移,并在File Inspector中切换7到<7个渲染(第一个选项卡中的公用事业专栏).当您必须在7中的布局中考虑状态栏或导航栏时,这通常会发挥作用.

| 归档时间: |
|
| 查看次数: |
1315 次 |
| 最近记录: |