Esqarrouth/EZSwiftExtensions

roundCorners ruins CollectionView

otymartin opened this issue · 5 comments

@goktugyil @Khalian
I'm using JSQMessagesViewController

When I use the self.collectionView?.layer.cornerRadius = 5. My collectionView stays intact however problem is this rounds all four corners.

screen shot 2017-01-24 at 1 14 11 pm

So Instead I use the EZSwiftExtensions methods...
let corners = UIRectCorner.topLeft.union(UIRectCorner.topRight) self.collectionView?.roundCorners(corners, radius: 5)

This creates a problem where my entire collectionView is being dragged around relative to the underlying view when I attempt to scroll the messages in my collectionView.

SCROLL DOWN
screen shot 2017-01-24 at 1 20 11 pm

SCROLL UP
screen shot 2017-01-24 at 1 21 01 pm

Hey @TimOliver... Do you have any idea why that is happening? I remember that you lib deals with round corners

Um, I'm not too sure where the 'roundCorners' property of the collection view is coming from, so I can't tell for sure what's happening.

But suffice it to say, setting the cornerRadius of a CALayer will round every corner. There's no way to selectively pick the corners that get rounded.

But you can get around this though by making a separate CALayer and then assigning it as the 'mask' property of that layer: http://stackoverflow.com/questions/10167266/how-to-set-cornerradius-for-only-top-left-and-top-right-corner-of-a-uiview

This is not really my expertise, @lfarah is there something we can do here ?

I think that that's not something we can implement on EZSwiftExtensions, but @otymartin has to implement @TimOliver's answer on his code.
Closing this, but if there are any other questions, feel free to re-open