LoginSignup
1
1

More than 3 years have passed since last update.

<Swift>CollectionViewCellに薄い影をつける

Posted at
TodolistDetailViewController.swift
    private func todolistCell(indexPath: IndexPath, todo: Todo) -> UICollectionViewCell {
        if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TodolistDetailCollectionViewCell", for: indexPath ) as? TodolistDetailCollectionViewCell{
            cell.update(todoTitle: todo.title, todoExpireDate: todo.expireDate)

            // セルの境界からはみ出ているものを見えるようにする
            cell.layer.masksToBounds = false
            // 影をつける
            cell.layer.shadowOffset = CGSize(width: 0, height: 1)
            cell.layer.shadowOpacity = 0.2
            cell.layer.shadowRadius = 1.0

            return cell
        }
        return UICollectionViewCell()
    }

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1