系统版本的判断
1.系统版本的判断
1).
if([[[UIDevicecurrentDevice] systemVersion] isEqualToString:@"7.0"]) {//do stuff}
2).
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_9_0) { // do stuff for iOS 9 and newer}else { // do stuff for older versions than iOS 9}
3)
#ifndef kCFCoreFoundationVersionNumber_iOS_7_0 #define kCFCoreFoundationVersionNumber_iOS_7_0 847.20#endif
2.app兼容最小版本号
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
3.self.layer.allowsGroupOpacity = NO;
/*在 iOS7 中,这个属性表示 layer 的 sublayer 是否继承父 layer 的透明度,主要用途是当改变一个 layer 的透明度时(会引起子 view 的透明度显示出来)。但是如果你不需要这种绘制类型,可以关闭这个属性来提高性能。 When true, and the layer’s opacity property is less than one, the layer is allowed to composite itself as a group separate from its parent. This gives the correct results when the layer contains multiple opaque components, but may reduce performance. The default value of the property is read from the boolean UIViewGroupOpacity property in the main bundle’s Info.plist. If no value is found in the Info.plist the default value is YES for applications linked against the iOS 7 SDK or later and NO for applications linked against an earlier SDK.*/
4.
//如果使用autolayout设置为NO
indicator.translatesAutoresizingMaskIntoConstraints = NO;
5.
//当一个自定义view的某个属性发生改变,并且可能影响到constraint时,需要调用此方法去标记constraints需要在未来的某个点更新,系统然后调用updateConstraints.
[self setNeedsUpdateConstraints];