// // StackableViewController.h // myverizon // // Created by Scott Pfeil on 3/26/14. // Copyright (c) 2014 Verizon Wireless. All rights reserved. // // This view controller is here to enable faster development of standard form screens. Put all ui objects that you want to be displayed in a top down order in an array and then call the generateFormWithUIArray. Any type can go in it. #import @interface StackableViewController : ProgrammaticScrollViewController // An array of ui elements that will be spaced out on the screen top to bottom from index 0 to formUIArray.count. @property (nullable, strong, nonatomic) NSArray *formUIArray; // Generates the form view with the passed in form ui array. - (void)generateFormViewWithUIArray:(nullable NSArray *)formUIArray; - (void)generateFormView:(nullable UIView *)view withUIArrayForConstrainingViews:(nullable NSArray *)formUIArray; // Returns the spacing that should surround the passed in item. Subclass this to change spacing. - (UIEdgeInsets)spaceAroundUIObject:(nullable id)object; // When using constraining views in the form array, resets the space that should surround each element. - (void)resetSpaceForFormArrayWithConstrainingViews; // Removes all the subviews in the form ui array. - (void)removeUIViews; // Removes all the subviews in the passed in array. + (void)removeUIViews:(nullable NSArray *)views; // Returns the standard space around ui objects. + (UIEdgeInsets)standardSpaceAroundUIObject; // Consolidates generateFormViewWithUIArray and spaceArroundUIObject into one class object so other view controllers can take advantage of these functions. + (void)populateView:(nonnull UIView *)view withUIArray:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; + (void)populateViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; + (void)populateView:(nonnull UIView *)view withUIArrayForConstrainingViews:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; // Does the actual laying out. The formuiarray views should already be added to the view. + (void)autoLayoutView:(nonnull UIView *)view withUIArray:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; + (void)autoLayoutViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; + (void)autoLayoutViewWithConstrainingViewsWithUIArray:(nonnull NSArray *)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock; @end