https://github.com/pheuter/mfwalkthrough
A container view controller for iOS that manages conditional navigation between view controllers
https://github.com/pheuter/mfwalkthrough
delegate-methods ios objective-c transition
Last synced: about 1 year ago
JSON representation
A container view controller for iOS that manages conditional navigation between view controllers
- Host: GitHub
- URL: https://github.com/pheuter/mfwalkthrough
- Owner: pheuter
- License: mit
- Created: 2014-03-18T01:58:55.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-22T23:29:00.000Z (about 12 years ago)
- Last Synced: 2025-03-18T21:07:41.822Z (about 1 year ago)
- Topics: delegate-methods, ios, objective-c, transition
- Language: Objective-C
- Homepage: http://pheuter.github.io/MFWalkthrough/
- Size: 246 KB
- Stars: 35
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# MFWalkthrough
[](https://travis-ci.org/pheuter/MFWalkthrough)
[](http://cocoadocs.org/docsets/MFWalkthrough)
## Blog post
[MFWalkthrough: A Container View Controller for iOS](http://blog.markfayngersh.com/mfwalkthrough-container-view-controller-for-ios)
## Installation
MFWalkthrough is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:
pod "MFWalkthrough", "~> 0.0.2"
## Demo
You can find the sample project in **Example/WalkthroughDemo**.

## Usage
### Display walkthrough containing 3 view controllers
- `MFWalkthroughDataSource` - Used to determine what property to observe to enable transitions
- `MFWalkthroughDelegate` - React to various transitions and states
```objective-c
#import
@interface ViewController : UIViewController
```
In the implementation,
```objective-c
// Initialize your view controllers
UIViewController *firstController;
UIViewController *secondController;
UIViewController *lastController;
// Create the MFWalkthroughViewController instance
MFWalkthroughViewController *walkthroughController =
[[MFWalkthroughViewController alloc]
initWithViewControllers:@[ firstController, secondController, lastController ]];
// Present the walkthrough controller
[self.navigationController pushViewController:walkthroughController
animated:YES];
```
Required data source method:
```objective-c
- (NSString *)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController enableContinuePropertyForViewController:(UIViewController *)viewController {
return @"somePropertyThatDeterminesIfContinueIsEnabled";
}
```
Required delegate methods:
```objective-c
- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willGoBackFromFirstViewController:(UIViewController *)firstViewController {
NSLog(@"I'm at the very beginning!");
}
- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willContinueFromLastViewController:(UIViewController *)lastViewController {
NSLog(@"I'm at the very end!");
}
```
The following delegate methods are optional:
- `- (void)walkthroughViewController:couldNotContinueFromViewController:`
- `- (void)walkthroughViewController:willContinueFromViewController:toViewController:`
- `- (void)walkthroughViewController:willGoBackFromViewController:toViewController:`
Refer to source documentation for more detail
## Customization
MFWalkthrough is designed to be used in conjunction with UINavigationController, simplifying conditional transitions between view controllers depending on some intermediate state.
[FRDLivelyButton](https://github.com/sebastienwindal/FRDLivelyButton) is used to render the navigation buttons. You can customize the button colors and line widths via the following `MFWalkthroughViewController` properties:
- `(UIColor *)navigationButtonColor` - Defaults to `navigationBar.tintColor`
- `(CGFloat)navigationButtonLineWidth` - Defaults to `3.0f`
## Testing
To run the unit tests:
$ cd Example
$ make install
$ make ci
## Author
Mark Fayngersh, phunny.phacts@gmail.com
## License
MFWalkthrough is available under the MIT license. See the LICENSE file for more info.