PXPinnedRotation
允许您创建使用固定旋转的视图
当手机旋转时,您的视图将保持原位,但会旋转,例如iOS中相机应用中的库和过滤器按钮。
使用 PXPinnedRotation
需要执行以下几步
PXPinnedRotationView
和 PXPinnedRotationViewController
。[self addSubviewToAnimate:]
。[self manuallyStartLayoutPass]
。-(NSArray*)calculateBaseConstraintsBeforeLayoutPass
将所有代码放在此处,就像您通常会将代码放在 -(void)updateConstraints
中一样。您指定的任何需要动画的视图都将进行动画处理。其他内容在旋转期间将保持不变。
如果您在旋转期间或之后需要额外的行为,可以在视图控制器上分配一些块。查看头文件以获取更多信息。
以上还有一个示例项目。要运行它,首先从 Git 仓库克隆,然后首先从 Example 目录中运行 pod install
。
PXPinnedRotation 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "PXPinnedRotation"
Daniel Blakemore,[email protected]
PXPinnedRotation 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。