Git Product home page Git Product logo

setupcontroller's Introduction

SetupController

CI Status Version License Platform

A MBSetupController is a subclass of UIViewController controller that acts like a wizard or setup assistant to present a sequence of dialog views that lead the user through a series of steps.

It has been inspired by the iOS Setup.app application which is presented to user during the first-time device setup.

SetupController SetupController

Features

  • Support for universal iOS8 applications with portrait and landscape orientations.
  • A couple of predefined page view controllers like MBTableViewPageController, MBProgressPageController or MBFinishPageController offers a lot of functionality out-of-the-box to quickly build pages for MBSetupController.
  • Predefined MBTableViewPageController use blocks instead of delegate calls to keep the table view's section code in one place, supports autolayout, and autosizing cells (iOS8 feature).

Demo

A demo project is included in the repository. To run it, clone the repo, and run pod install from the Example directory first.

Requirements

Minimum iOS Target Notes
iOS 8 -

Installation

SetupController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SetupController"

##Architecture

###Setup View Controller

  • MBSetupController

###Page View Controllers

  • MBBasePageController
    • MBTableViewPageController
    • MBProgressPageController
    • MBFinishPageController

###Items and cells for MBTableViewPageController

  • MBSetupPageItem
    • MBLabelItem
    • MBTextFieldItem
  • MBSetupPageCell
    • MBLabelCell
    • MBTextFieldCell

##Quick Start

###Implement setup controller's data source

  1. Subclass MBSetupController

    @interface MBSampleSetupController : MBSetupController <MBSetupControllerDataSource>
  2. Set initial view controller

    - (void)viewDidLoad {
        [super viewDidLoad];
        MBAccountController *initialController = [[MBAccountController alloc] init];
        [self setViewControllers:@[initialController] animated:NO];
    }
  3. Implement MBSetupControllerDataSource protocol

    - (UIViewController<MBPage> *)setupController:(MBSetupController *)setupController viewControllerAfterViewController:(UIViewController<MBPage> *)viewController {
        if ([viewController isKindOfClass:[MBAccountController class]]) {
            MBProgressController *progressController = [[MBProgressController alloc] init];
            progressController.labelTitle = @"It may take a while to set up your account...";
            return progressController;
        }
        
        return nil;
    }

###Implement Page View Controller

  1. Subclass MBTableViewPageController

    @interface MBAccountController : MBTableViewPageController

    Next steps are all inside -viewDidLoad.

  2. Create section

    MBSetupPageSection *section = [MBSetupPageSection sectionWithTitle:@"Configure Account"];
  3. Configure section's header

    section.headerViewBlock = ^UIView*(MBSetupPageSection *section) {
        return [weakSelf preparedPageHeaderViewWithTitle:section.title];
    };
    
    section.headerHeightBlock = ^CGFloat(UITableView *tableView, MBSetupPageSection *section, UIView *view) {
        CGSize size = [view sizeThatFits:CGSizeMake(tableView.frame.size.width, 0)];
        return size.height;
    };
  4. Configure section's footer

    section.footerViewBlock = ^UIView*(MBSetupPageSection *section) {
    	MBSectionFooter *footer = [weakSelf preparedFooterViewWithImage:[UIImage imageNamed:@"SampleImage"]
                                                                  title:@"Sign in with your account credentials"
                                                               subtitle:@"Your credentials should have been sent to you by administrator. Contact our support team if you have any questions."];
        [footer.topButton setTitle:@"Skip This Step" forState:UIControlStateNormal];
        [footer.topButton addTarget:weakSelf action:@selector(skip) forControlEvents:UIControlEventTouchUpInside];
        return footer;
    };
    
    section.footerHeightBlock = ^CGFloat(UITableView *tableView, MBSetupPageSection *section, UIView *view) {
        CGSize size = [view sizeThatFits:CGSizeMake(tableView.frame.size.width, 0)];
        return size.height;
    };
  5. Create and configure text field item

    MBTextFieldItem *hostItem = [[MBTextFieldItem alloc] initWithTitle:@"Host" text:nil placeholder:@"example.com"];
    hostItem.keyboardType = UIKeyboardTypeURL;
    hostItem.autocorrectionType = UITextAutocorrectionTypeNo;
    hostItem.autocapitalizationType = UITextAutocapitalizationTypeNone;
    hostItem.textDidChangeBlock = ^(MBTextFieldItem *item) {
        [weakSelf validate];
    };
    hostItem.validateBlock = ^BOOL(MBSetupPageItem *item) {
        return [(MBTextFieldItem *)item text].length > 0;
    };
  6. Add item to section

    section.items = @[hostItem];
  7. Set sections property of the MBTableViewPageController

    self.sections = @[section];

###Present Setup Controller

MBSampleSetupController *setupController = [[MBSampleSetupController alloc] init];
setupController.dataSource = setupController;

[self presentViewController:setupController animated:YES completion:nil];

Author

Maksim Bauer, [email protected]

License

SetupController is available under the MIT license. See the LICENSE file for more info.

setupcontroller's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bigdig

setupcontroller's Issues

Example fails to build on simulator with codesign error

This looks awesome, thanks so much for making this available! :-)

I've tried turning off all code signing everywhere in the workspace and it still fails with:

CodeSign /Users/joel/Library/Developer/Xcode/DerivedData/SetupController-gzouxnkpbngnkvcafgdgnnlmxhqo/Build/Products/Debug-iphonesimulator/SetupController.bundle
    cd /Users/joel/Downloads/SetupController-master/Example/Pods
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    
Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --timestamp=none /Users/joel/Library/Developer/Xcode/DerivedData/SetupController-gzouxnkpbngnkvcafgdgnnlmxhqo/Build/Products/Debug-iphonesimulator/SetupController.bundle

/Users/joel/Library/Developer/Xcode/DerivedData/SetupController-gzouxnkpbngnkvcafgdgnnlmxhqo/Build/Products/Debug-iphonesimulator/SetupController.bundle: bundle format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1

I am using Xcode Version 8.2.1 (8C1002) on OS X 10.12.3.

Any ideas?

Also, why is it trying to codesign on a simulator build?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.