Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Block based callbacks for UINavigationController willShow and DidShow

License

Notifications You must be signed in to change notification settings

seivan-archives/SHNavigationControllerBlocks

Repository files navigation

Deprecated, please use RxCocoa

SHNavigationControllerBlocks

CI Status Version Platform License

This pod is used by SHUIKitBlocks as part of many components covering to plug the holes missing from Foundation, UIKit, CoreLocation, GameKit, MapKit and other aspects of an iOS application's architecture.

Overview

Life cycle blocks for UINavigationController - willShow and didShow. The blocks are automatically removed once they UINavigationController is gone, so it isn't necessary to clean up - Swizzle Free(™)

API

Installation

pod 'SHNavigationControllerBlocks' 
pod 'SHNavigationControllerBlocks', '~> 1.0.0' # for iOS 6

Setup

Put this either in specific files or your project prefix file

#import "UINavigationController+SHNavigationControllerBlocks.h"

or

#import "SHNavigationControllerBlocks.h"

API

Properties

#pragma mark - Block Definitions
typedef void (^SHNavigationControllerBlock)(UINavigationController * navigationController,
                                            UIViewController       * viewController,
                                            BOOL                      isAnimated);

typedef UIInterfaceOrientation(^SHNavigationControllerOrientationBlock)(UINavigationController * navigationController);

typedef id<UIViewControllerInteractiveTransitioning>
(^SHNavigationControllerInteractiveControllerBlock)(UINavigationController * navigationController,
                                                    id<UIViewControllerAnimatedTransitioning> animationController);

typedef id<UIViewControllerAnimatedTransitioning>
(^SHNavigationControllerAnimatedControllerBlock) (UINavigationController * navigationController,
                                                  UINavigationControllerOperation operation,
                                                  UIViewController * fromVC,
                                                  UIViewController * toVC
                                                  );


@interface UINavigationController (SHNavigationControllerBlocks)



#pragma mark - Properties

#pragma mark - Setters

-(void)SH_setWillShowViewControllerBlock:(SHNavigationControllerBlock)theBlock;

-(void)SH_setDidShowViewControllerBlock:(SHNavigationControllerBlock)theBlock;

-(void)SH_setPreferredInterfaceOrientationForPresentatationBlock:(SHNavigationControllerOrientationBlock)theBlock;

-(void)SH_setInteractiveControllerBlock:(SHNavigationControllerInteractiveControllerBlock)theBlock;

-(void)SH_setAnimatedControllerBlock:(SHNavigationControllerAnimatedControllerBlock)theBlock;

#pragma mark - Getters

@property(nonatomic,readonly) SHNavigationControllerBlock SH_blockWillShowViewController;
@property(nonatomic,readonly) SHNavigationControllerBlock SH_blockDidShowViewController;
@property(nonatomic,readonly) SHNavigationControllerOrientationBlock SH_blockInterfaceOrientationForPresentation;
@property(nonatomic,readonly) SHNavigationControllerInteractiveControllerBlock SH_blockInteractiveController;
@property(nonatomic,readonly) SHNavigationControllerAnimatedControllerBlock SH_blockAnimatedController;


@end

Contact

If you end up using SHNavigationControllerBlocks in a project, I'd love to hear about it.

email: [email protected]
twitter: @seivanheidari

License

SHNavigationControllerBlocks is © 2013 Seivan and may be freely distributed under the MIT license. See the LICENSE.md file.

About

Block based callbacks for UINavigationController willShow and DidShow

Resources

License

Stars

Watchers

Forks

Packages

No packages published