Giter Club home page Giter Club logo

flkautolayout's People

Contributors

alloy avatar arturgrigor avatar chadwilken avatar ekurutepe avatar endocrimes avatar fastred avatar floriankugler avatar iandundas avatar jordanbrown avatar nwalter08 avatar orta avatar revolter avatar robertjpayne avatar timshadel avatar

Stargazers

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

Watchers

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

flkautolayout's Issues

It may cause crash when using `FLKNoConstraint`

Here is what I am using:

button.alignTop("20", leading: FLKNoConstraint, bottom: FLKNoConstraint, trailing: "-27", toView: self.view)

In previous version, it works perfectly, but in 1.0 version, it cause crash.

run in xcode6.3.1 broken

FLKAutoLayoutExample[1418:44977] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs'

broken at here:
UIView+FLKAutoLayoutPredicate.h

NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self
attribute:fromAttribute
relatedBy:predicate.relation
toItem:view
attribute:toAttribute
multiplier:predicate.multiplier
constant:predicate.constant];

topLayoutGuide support

FLK doesn't seem to handle the following:

[self.topView alignTopEdgeWithView:self.topLayoutGuide predicate:@"0"];

Which I would assume represents the following code:

NSLayoutConstraint* cn = [NSLayoutConstraint constraintWithItem:self.topView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom
multiplier:1.0 constant:0];
[self.view addConstraint:cn];

Getting an existing NSLayoutConstraint

Working with a graph bar I needed to update a constant to make an UIViewAnimation. FLKAutoLayout is amazing with adding but it lacks support for get or update constraints.

Would be nice to be able to get an existing constraint by type just for update their constant or just maybe for delete and add again with new values.

I've tried one snipped I found (not mine) http://stackoverflow.com/questions/13857115/getting-an-existing-nslayoutconstraint-for-the-width and it works perfectly.

Awesome library anyway!!!

Add ability to use topLayoutGuide, bottomLayoutGuide

iOS7 added the concept of top & bottomLayoutGuide. It would be nice to be able to add something right underneath the UINavigationBar, and topLayoutGuide allows for this, like so:

[self.view addConstraint: 
  [NSLayoutConstraint constraintWithItem:self.someSubview 
  attribute:NSLayoutAttributeTop 
  relatedBy:NSLayoutRelationEqual 
  toItem:self.topLayoutGuide 
  attribute:NSLayoutAttributeBaseline 
  multiplier:1 
  constant:0]
];

flk_autolayoutTrace fails submission in xcode 6.1.1

My app fails private api usage check when submitting with application loader and xcode. I removed the flk_autolayoutTrace method and it submitted with no issue. I have submitted this code in previous versions of xcode so must be a new thing

make `chainViews:usingBlock:` public, add methods for aligning the centers of an array of views.

I think it would be nice if chainViews:usingBlock: was available to use anywhere with an arbitrary block. What do you think?

In particular, I'd like to have something similar to alignLeadingEdgesOfViews: that would align the centers of views in either or both axes. I often have views of different widths and would like to ensure that their centerX is aligned.

Photoshop has this:
screen shot 2015-07-10 at 4 56 51 pm

untitled-1 untitled-2

Equivalent:

+ (NSArray*)alignCenterXOfViews:(NSArray*)views {
    return [self chainViews:views usingBlock:^NSArray*(UIView* view1, UIView* view2) {
        return [view2 alignCenterXWithView:view1 predicate:nil];
    }];
}

I'm happy to PR these particular center-alignment chaining methods, but it would be nice if the underlying chainViews method was available, too.

Use Swift's protocol extensions to remove the `id` for the view / layout guide

Currently the API is:

- (NSArray <NSLayoutConstraint *> *)alignToView:(id)view;

This id isn't optimal. With Swift we could do something like:

@objc protocol FLKViewable {
  var flkView: UIView { get }
}

extension UIView: FLKViewable {
  var flkView: UIView  {
    return self
  }
}
extension UILayoutGuide: FLKViewable {
  var flkView: UIView  {
    return self.representedView
  }
}
extension FLKLayoutGuide: FLKViewable {
  var flkView: UIView  {
    return self.flk_view
  }
}

Then we could constrain the view to be a FLKViewable:

- (NSArray <NSLayoutConstraint *> *)alignToView:(NSObject <FLKViewable> *)view;

nil predicate not equal to @"0"

the changes to FLKAutoLayout/UIView+FLKAutoLayout.m in commit c8f5ec0 should be reverted, imho.

If you pass a nil predicate into any of the methods whose behaviour is changed there, it won't act like you actually passed @"0", but will actually not add any constraints at all, which is inconsistent with all the other methods.

Example project layout problem

Hi, I have just installed FLKAutoLayout. It looks powerful. But when I run example layout not always look same. Here is how example looks after run in simulator. Also when switch orientation, space between left and right view (views with dark grey colour as background) has random width. Here is one screenshot.
screenshot 2014-01-29 21 39 29

Constraint Methods Should Accept Format Strings

If I have certain UI constants, I should be able to pass those directly to the constraint methods as a predicate with printf-style specifiers.

Currently, you need:

{
  [view alignTopEdgeWithView:superview 
                   predicate:[NSString stringWithFormat:@"%@", [settings paddingFromTop]]];
}

Instead of the simpler:

{
  [view alignTopEdgeWithView:superview predicate:@"%@", [settings paddingFromTop]];
}

example app crashes

this is part of the log

translatesAutoresizingMaskIntoConstraints) 
(
    " H:[UIView:0x7fcb10e31a20(80)] (Bar view 0, (null))",
    " H:[UIView:0x7fcb10e31a20(100)] (Bar view 0, (null))"
)
....

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs'

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.