您的位置:首页 > 移动开发 > IOS开发

IOS开发 ios7适配

2013-10-18 15:36 316 查看
  ios7控制器试图默认为全屏显示,导航栏的不同设置会产生不同的效果.

  首先判断系统的的版本,区别:

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)

官方推荐的版本判断

NSUInteger DeviceSystemMajorVersion();
NSUInteger DeviceSystemMajorVersion() {
static NSUInteger _deviceSystemMajorVersion = -1;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion]
componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
});
return _deviceSystemMajorVersion;
}
#define MY_MACRO_NAME (DeviceSystemMajorVersion() < 7)

导航栏的颜色设置新增属性为barTintColor

具体写法:

  if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
} else {
self.navigationController.navigationBar.barTintColor = [UIColor brownColor];
}

  导航栏的属性:tintColor用于设置控件颜色

  导航栏的背景图片不同的size会显示不同的效果.

  导航栏中设置空间的image对象都需要进行渲染设置,默认是渲染为末模板,需要渲染为原图才能显示.

  bar的样式   barStyle

  bar的透明度  translucent

  bar的颜色    barTintColor

  bar上控件的颜色 tintColor

  bar的背景图片  backgroundImage

 

  字体: 

  通过 UIFont 中的 [code]preferredFontForTextStyle
属性回去当前系统的字体,确保内容在不同字体下都能很好显示。[/code]
 

  Bars 和 Bar Buttons

  status bar 默认是透明的,其他 bar 都是半透明的,一个通用原则:确保内容填充 Bar 下面的区域。

  navigationBar 在
UIBarPositionTopAttached
模式下会与 status bar 融合的,所以如果使用图片需要用 128px((20 + 44) x 2)。

  通过设置控制器的edgesForExtendedLayout 为uirectedgesnone也可以将控制器视图从导航栏下显示,这个属性是iOS7新增的;

  UITableView

  Grouped table 没有边距了,TableView 上的图标(如:Checkmark,Disclosure indicator,Delete button 等)都变了。

  转载请注明出处!!!  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: