这是一个用于 iOS 的静态库,通过左右滑动可以在 UIViewController 中进行导航。它支持任意数量的子视图控制器以及通知底层控制器位置变化的自定义叠加视图。
还包括一个示例项目,允许在不使用 TabBar 等导航的情况下在 3 个主导航堆栈之间进行滑动。演示项目还显示了一个浮动叠加栏,可以给出滑动堆栈中当前位置的提示。
有关如何开始使用此静态库的说明,请参阅 rheard.com 上的使用静态 iOS 库。
在修改后的 BSD 许可证下发布。 (需归属)
RHHorizontalSwipe Copyright (c) 2012 Richard Heard. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
此代码在至少 4.3 上工作并已过测试,但官方对 iOS5 之前的 UIViewController 容纳没有支持。
这意味着在使用默认的 [self presentModalViewController:animated:] 时呈现模态视图 / 弹出视图会有一些异常行为。为了解决这个问题,您必须使用 [appDelegate.layoutScrollViewController presentModalViewController:animated:]。代码中已有相关注释。