MissingAnchors 0.6.0

MissingAnchors 0.6.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2017年10月

Anton Bukov 维护。







将 Apple NSLayoutAnchor API 迁移到 iOS7 以及一些遗漏,如 sizeAnchoredgesAnchor

使用方法

###迁移所有默认锚点方法

  • view.leadingAnchor
  • view.trailingAnchor
  • view.leftAnchor
  • view.rightAnchor
  • view.topAnchor
  • view.bottomAnchor
  • view.widthAnchor
  • view.heightAnchor
  • view.centerXAnchor
  • view.centerYAnchor
  • view.firstBaselineAnchor
  • view.lastBaselineAnchor

###额外实现的锚点

  • view.sizeAnchor
  • view.edgesAnchor

锚点上有一些额外的方法

  • anchor.withTopAnchor
  • anchor.withBottomAnchor
  • anchor.withLeadingAnchor
  • anchor.withTrailingAnchor
  • edgesAnchor.withoutTopAnchor
  • edgesAnchor.withoutBottomAnchor
  • edgesAnchor.withoutLeadingAnchor
  • edgesAnchor.withoutTrailingAnchor

使用示例

#import <MissingAnchors/MissingAnchors.h>

...

[view1.edgesAnchor constraintsEqualToConstant:UIEdgeInsetsMake(10, 20, 30, 40)].active = YES;
[view2.topAnchor.withBottomAnchor constraintsEqualToConstant:UIEdgeInsetsMake(10, 0, 30, 0)].active = YES;
[view3.edgesAnchor.withoutTopAnchor constraintsEqualToConstant:UIEdgeInsetsMake(0, 20, 30, 40)].active = YES;

###现代活动属性

#import <MissingAnchors/MissingAnchors.h>

...

@[
   [view1.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:10],
   [view1.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:20],
   [view1.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-30],
   [view1.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-40],
].active = YES;

需求

安装

MissingAnchors 通过 CocoaPods 提供。要安装,只需向您的 Podfile 添加以下行
作者

pod 'MissingAnchors'
pod 'MissingAnchors/NSLayoutAnchor' # if you need a backport of NSLayoutAnchor to iOS 7

Anton Bukov, [email protected]

MissingAnchors 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。

许可证

CocoaPods 是来自