Is there any current bugs when setting constraints to an UICollectionViewCell subview?

RodrigoLiraRodrigoLira USMember ✭✭

I have an UICollectionView within an UIViewController. The UICollectionView has a single "prototype" cell where I added a single subview (through Storyboard - on Visual Studio 2015, I should say).

Now, as I do with any other View, I select that and start grabbing the top anchor and drop it at the Cell's top. Once the first constraint is added, I can no longer select the subview to keep adding the other constraints.

As soon as a single constraint is added, the cell's subview is no longer selectable. I tried selecting the view and using the button "Add constraints" at the top of the designer but it is adding constraints for Top, Leading, Height and Width. What I want are Top, Leading, Trailing and Bottom constraints.

Is there any bugs on Xamarin designer for Visual Studio right now? What can possibly be making my cell's subview unselectable?

I guess I'm gonna try to add the constraints through code but I'd really prefer to do it on the designer.

Best Answer

Answers

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @RodrigoLira

    Not sure if it is a bug. I could not reproduce the behavior based on your description. I tested by creating a Single View iOS new project and adding a collection view to the view controller and then putting a label in the cell prototype. I was then able to set constraints on all four sides without issue. Can you provide more explicit steps to reproduce the issue?

  • RodrigoLiraRodrigoLira USMember ✭✭

    @JGoldberger you are correct, dropping an UILabel on a CollectionViewCell will not cause the problem.

    After testing the Label, I deleted it, dragged and dropped an UIView, set up the first constraint, and the view becomes unselectable.

    This also happens here if I drop an UIImageView inside the cell.

    The UILabel seems to be "immune" to this problem.

  • RodrigoLiraRodrigoLira USMember ✭✭

    @JGoldberger Thank you! I was looking for confirmation to see whether I should open a bug report there. Since you already opened, great!

    As a workaround, I created a CollectionViewCell subclass and added the components and constrains in code.

Sign In or Register to comment.