Click here to load reader

Storyboard Segregation

  • View
    247

  • Download
    2

Embed Size (px)

Text of Storyboard Segregation

  • Storyboards Segregation

  • ?

  • storyboard

  • storyboard

    ,

    ,

    .

  • .

    , , storyboard.

    .

  • storyboards

    1. user stories.

    2. Main.storyboard.

    3. storyboards.

  • storyboard :

    user story (Settings User Story),

    storyboards (Photos User Story).

    storyboards.

  • Storyboard-to-Storyboard

  • pushViewController:

  • pushViewController:

  • Segues

  • LinkedStoryboardSegueSegue Identifier:

    MSAPhotoGalleryViewController_Photos

  • LinkedStoryboardSegue

    @interface MSALinkedStoryboardSegue : UIStoryboardSegue

    + (UIViewController *)sceneNamed:(NSString *)identifier;

    @end

  • LinkedStoryboardSegue

  • UITabBarController

  • UITabBarController- (UITabBarController *)tabBarController { return [TyphoonDefinition withClass:[UITabBarController class] configuration:^(TyphoonDefinition *definition) { [definition injectProperty:@selector(viewControllers) with:[self storyboardsInitialViewControllers]]; }]; }

    - (NSArray *)storyboardsInitialViewControllers { return @[ [[UIStoryboard storyboardWithName:MSABreedsStoryboardIdentifier bundle:[NSBundle mainBundle]] instantiateInitialViewController], [[UIStoryboard storyboardWithName:MSABestCatStoryboardIdentifier bundle:[NSBundle mainBundle]] instantiateInitialViewController], [[UIStoryboard storyboardWithName:MSASettingsStoryboardIdentifier bundle:[NSBundle mainBundle]] instantiateInitialViewController] ]; }

  • ?

    ViewController .

    ViewController ViewController.

  • [email protected] UIViewController (Routing)

    @property (nonatomic, strong) id router;

    @end

    @protocol MSARoutingProtocol

    - (instancetype)initWithNavigationController:(UINavigationController *)navigationController;

    - (void)dismissCurrentViewController:(UIViewController *)viewController animated:(BOOL)animated;

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender;

    @end

  • [email protected] MSABreedsRouter

    - (void)showBreedViewControllerFromSourceController:(UIViewController *)sourceController withCatBreed:(MSACatBreed *)catBreed;

    - (void)showPhotosViewControllerFromSourceController:(UIViewController *)sourceController withCatBreed:(MSACatBreed *)catBreed;

    - (void)showWarningViewControllerFromSourceController:(UIViewController *)sourceController;

    @end

  • ?

    1. UIViewController+Routing: prepareForSegue -> msa_prepareForSegue

    2. : - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender userInfo:(NSDictionary *)userInfo;

    - (NSDictionary *)segueUserInfo:(UIStoryboardSegue *)segue;

  • user stories, .

    Storyboard xib .

  • Storyboard Constants

    Receiver () has no segue with identifier breedDetailSegue

  • Storyboard Constants

    Receiver () has no segue with identifier breedDetailSegue

    :(

  • Storyboard Constants

    generate_constants.py -> MSAStoryboardsIdentifiers.h

    /* Segue identifier constants */ @class NSString;

    extern NSString * const sBreedDetailSegue; extern NSString * const sMSAPhotoGalleryViewController_Photos; extern NSString * const sMSAPhotoViewController_Photos; extern NSString * const sPhotoViewSegue; extern NSString * const sWarningSegue;

  • Storyboard Constants

    Build Phases .

    ID .

    , .

  • User Stories

    User Stories:

  • : https://github.com/

    igrekde/MultipleStoryboardsSample

    Reusing Views with Auto Layout: http://cocoanuts.mobi/2014/03/26/reusable/

    Easier Multiple Storyboards: http://spin.atomicobject.com/2014/03/06/multiple-ios-storyboards/