Skip to content

A class that provides factory methods for UIKit control set up in common ways.

License

Notifications You must be signed in to change notification settings

ElectricPeelSoftware/EPSUIFactory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EPSUIFactory

EPSUIFactory is a class which provides factory methods for common configurations of UIKit controls. Some examples are:

  • UILabel
  • UITextField set up for email entry
  • UITextField set up for password entry
  • UIView set up to be used as the container view in a UIScrollView which should only scroll vertically

All views returned by EPSUIFactory are ready to be used with auto layout (ie. they have translatesAutoresizingMaskIntoConstraints set to NO.)

Usage

Factory Methods

- (void)viewDidLoad {
  [super viewDidLoad];

  UITextField *passwordField = [EPSUIFactory passwordTextField];
  [self.view addSubview:passwordField];
  // Add some constraints on `passwordField`
  ...
}

For complete documentation of the methods available, see EPSUIFactory.h.

UIView+EPSAutoLayout

There is an included category on UIView which makes setup for views not included in the factory methods easier. Use eps_initForAutoLayout instead of initWithFrame: when you are creating a view for use with auto layout. For example:

UIView *view = [[UIView alloc] eps_initForAutoLayout];

is equivalent to

UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.translatesAutoresizingMaskIntoConstraints = NO;

Example Project

To run the example project; clone the repo, and run pod install from the “Project” directory first.

Installation

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

pod "EPSUIFactory"

Alternatively, add all files from the “Classes” folder to your project.

License

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

About

A class that provides factory methods for UIKit control set up in common ways.

Resources

License

Stars

Watchers

Forks

Packages

No packages published