AMWaveTransition 0.6.2

AMWaveTransition 0.6.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年12月

Andrea Mazzini 维护。



Build Status Flattr

在持有表格视图的 viewcontroller 之间实现自定义过渡。每个单元格都会进行动画来模拟“波浪效果”。

了解更多关于过渡的信息 请单击此处,以及关于 UIKit Dynamics 的信息 请单击此处

屏幕截图

AMWaveTransition

入门指南

作为基类设置

  • AMWaveViewController 派生并重写 visibleCells,或按照以下步骤操作。

手动设置

实现 UINavigationControllerDelegate 和此代理方法。

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                  animationControllerForOperation:(UINavigationControllerOperation)operation
                                               fromViewController:(UIViewController*)fromVC
                                                 toViewController:(UIViewController*)toVC {
    if (operation != UINavigationControllerOperationNone) {
        // Return your preferred transition operation
        return [AMWaveTransition transitionWithOperation:operation];
    }
    return nil;
}

请记得将您的实例设置为导航代理。

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationController setDelegate:self];
}

- (void)dealloc {
    [self.navigationController setDelegate:nil];
}

通过返回您的表格视图的可见单元格来实现 AMWaveTransitioning 协议。

- (NSArray*)visibleCells {
    return [self.tableView visibleCells];
}

交互式手势

要实现交互式手势,在您的视图控制器中创建一个新属性。

@property (strong, nonatomic) IBOutlet AMWaveTransition *interactive;

在您的 viewDidLoad 中对其进行初始化。

self.interactive = [[AMWaveTransition alloc] init];

viewDidAppear: 中附加手势识别器,并在 viewDidDisappear: 中将其移除。

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.interactive attachInteractiveGestureToNavigationController:self.navigationController];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self.interactive detachInteractiveGesture];
}

如果您要过渡到的视图控制器没有表格视图,不要实现 visibleCells,库将正确处理过渡。

如您在示例项目中看到的,最好将视图和单元格的背景设置为 clearColor,并将背景颜色或背景图片设置为导航控制器。

作者

Andrea Mazzini。我可供自由职业工作,请随时联系我。

想要支持这些免费库的开发?给我买杯咖啡吧☕️via Paypal

贡献者

感谢 所有 辛勤提交拉取请求的人。

MIT 许可协议

The MIT License (MIT)

Copyright (c) 2015 Andrea Mazzini

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.