Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to make collectionview rounded and add shadow to collectionview #682

Closed
NikhilGangurde opened this issue Apr 19, 2023 · 1 comment
Closed

Comments

@NikhilGangurde
Copy link

Screenshot 2023-04-19 at 9 33 02 PM

how can i make this view

here is what I tried and not working:

class RoundedPagingCell: PagingTitleCell {

   open override func setPagingItem(_ pagingItem: PagingItem, selected: Bool, options: PagingOptions) {
    super.setPagingItem(pagingItem, selected: selected, options: options)
       guard let item = pagingItem as? PagingIndexItem else { return }
    
    // Apply shadow to content view

    if item.index == 0 {
        contentView.dropShadow(offsetX: 0, offsetY: 0, color: .lightGray, opacity: 0.5, radius: 10)
    } else if item.index == 2 {
        contentView.dropShadow(offsetX: 0, offsetY: 0, color: .lightGray, opacity: 0.5, radius: 10)
    }
    
  }
    
}
@rechsteiner
Copy link
Owner

rechsteiner commented May 23, 2023

Hi @NikhilGangurde! It's a bit hard to say why that’s not working based on your example. In general, it should be possible to apply the corner radius inside the cell, based on the index of the item. Another option would be to apply the corner radius on the pagingController.collectionView itself. You can provide your own PagingView subclass where you can completely customize the layout and size of the collection view as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants