Latest 0.1.1
Homepage https://github.com/Raztor0/NSLayoutConstraint-Reset
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

Build Status
Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

First import NSLayoutConstraint+Reset.h

#import "NSLayoutConstraint+Reset.h"
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
UIView *constrainedView = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 20, 20)];
[container addSubview:constrainedView];

// Also works with NSLayoutConstraints created via InterfaceBuilder
NSLayoutConstraint *myConstraint = [NSLayoutConstraint constraintWithItem:constrainedView
                    attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
                    toItem:container attribute:NSLayoutAttributeTop multiplier:1.0f
                    constant:20.0f];

[myConstraint initializeConstraint];

NSLog(@"%f", myConstraint.constant); // 20.0
myConstraint.constant = 35.0f;
NSLog(@"%f", myConstraint.constant); // 35.0
[myConstraint reset];
NSLog(@"%f", myConstraint.constant); // 20.0

Installation

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

pod "NSLayoutConstraint+Reset"

Author

Razvan Bangu, [email protected]

License

NSLayoutConstraint+Reset is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "NSLayoutConstraint+Reset",
    "version": "0.1.1",
    "summary": "Reset the initial constant value of an NSLayoutConstraint.",
    "description": "When modifying NSLayoutConstraints through code, it is often the case that the constant value is initialized to a particular value, then changed, and later set back to the initial value. Instead of holding on to the initial value of every constraint which you need to modify in this way, NSLayoutConstraint+Reset does the work for you.",
    "homepage": "https://github.com/Raztor0/NSLayoutConstraint-Reset",
    "license": "MIT",
    "authors": {
        "Razvan Bangu": "raz[email protected]"
    },
    "source": {
        "git": "https://github.com/Raztor0/NSLayoutConstraint-Reset.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This