floriankugler / FLKAutoLayout

UIView category which makes it easy to create layout constraints in code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example project layout problem

opened this issue · comments

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

Sometimes when rotate there is red line (on right in picture below). This red colour is a background of UIWindow. I do not know why view of ALEViewController is sometimes resized (so red colour is visible).

update: I have add [self.view setTranslatesAutoresizingMaskIntoConstraints:NO]; to viewDidLoad and there is no anymore problem with red line,...but still have problem with textfields after launching app.
screenshot 2014-01-29 21 56 58

It also happens to me with the simulator and an iPad 2 running iOS 7.1.

The problem seems related to NSLayoutAttributeBaseline. if you try other layout attributes like NSLayoutAttributeBottom or NSLayoutAttributeCenterY the UITextView are correctly aligned with the UILabels.

Definitely it seems an Autolayout bug. I've reduced the sample to a bare minimum NSLayoutAttibuteBaseline test (https://gist.github.com/rbarbera/73dc24af0ad4477837bd). You can use [self buildWithFLKAutoLayout] method to build the UI using FLKAutoLayout methods or [self buildWithNSLayoutConstraint] to construct the same UI but using only Apple supplied APIs.

The results are the same: the textfields are misaligned for the first and last UITextField.
captura de pantalla de simulador ios 21 05 2014 10 05 50