nsomar / OAStackView

Porting UIStackView to iOS 7+
MIT License
2.14k stars 191 forks source link

issue with size classes... #45

Closed stallent closed 9 years ago

stallent commented 9 years ago

When i use OAStackView in a universal nib/storyboard it works great, but if i add any views anywhere (related to stackView or not) that are only installed in certain size classes, OAStackView won't render properly. Anyone else seen this and/or have a workaround?

stallent commented 9 years ago

if i implement traitCollectionDidChange: in OAStackView and then call layoutArrangedViews it seems to fix the issue

delebedev commented 9 years ago

@stallent can you provide small example project for this case, please?

stallent commented 9 years ago

No need. It reproduces in the example project. Simply select the StackView in the main storyboard and add a size class to it (Regular,Regular for example). You will notice the initial rendering is incorrect. Once you click buttons it fixes itself but the issue is layoutArrangedViews never gets called once you add a size class to the view in the nib.

delebedev commented 9 years ago

@stallent I've added size class and it looks fine for me. Can you please if the issue still exists in 0.2.0 tag?

stallent commented 9 years ago

Just tried. Still there. Steps to reproduce... Open example. Select the stackView instance in the storyboard and add this:

screen shot 2015-09-28 at 10 37 12 am

Run in simulator and initial rendering becomes this: (which isn't correct)

screen shot 2015-09-28 at 10 36 50 am

As I mentioned initially, the timing of when the view gets sized is different when you add a sizeClass and layoutArrangedViews is getting called too early.

delebedev commented 9 years ago

@stallent thanks a lot for this, now I'm finally managed to reproduce it

delebedev commented 9 years ago

@stallent fixed now :+1:

stallent commented 9 years ago

Thank you! Looks great!