floriankugler / flkautolayout Goto Github PK
View Code? Open in Web Editor NEWUIView category which makes it easy to create layout constraints in code
License: MIT License
UIView category which makes it easy to create layout constraints in code
License: MIT License
(NSArray_)distributeAttribute:(NSLayoutAttribute)attribute OfViews:(NSArray_)views inView:(UIView*)inView API is crashing in (iOS 8.3 SDK).
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.
When submitting to the appstore, the error is "The app references non-public selectors in Payload"
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];
Do we have any update plan for iPhone X with safe area layout guide?
NSLayoutConstraint+FLKAutoLayoutDebug.m Line 18, get asciiArtDescription
just crashed on iOS 14 official version.
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];
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!!!
topLayoutGuide and bottomLayoutGuide used to be subclasses of UIView, but they aren't in iOS9.
I patched my fork with this:
lisbakke@84eec85
reason : private api and undocumented api
Clicking the example project leads to a Github 404.
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]
];
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
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.
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.
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;
I set like this [qqBtn constrainAspectRatio:@"2:1"]; but it doesn't work!
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.
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.
see title
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]];
}
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'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.