瀏覽代碼

MediaCells: CornerRadius: Set masksToBounds to true

Soomin Lee 6 年之前
父節點
當前提交
a1650314ff

+ 1 - 0
Sources/MediaCategoryCells/GenreCollectionViewCell.swift

@@ -31,6 +31,7 @@ class GenreCollectionViewCell: BaseCollectionViewCell {
         super.awakeFromNib()
         NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .VLCThemeDidChangeNotification, object: nil)
         themeDidChange()
+        thumbnailView.layer.masksToBounds = true
         thumbnailView.layer.cornerRadius = thumbnailView.frame.size.width / 2.0
     }
 

+ 2 - 0
Sources/MediaCategoryCells/MediaCollectionViewCell.swift

@@ -52,6 +52,7 @@ class MediaCollectionViewCell: BaseCollectionViewCell {
     }
 
     func update(audiotrack: VLCMLMedia) {
+        thumbnailView.layer.masksToBounds = true
         thumbnailView.layer.cornerRadius = thumbnailView.frame.size.width / 2.0
         titleLabel.text = audiotrack.title
         descriptionLabel.text = audiotrack.albumTrack.artist.name
@@ -67,6 +68,7 @@ class MediaCollectionViewCell: BaseCollectionViewCell {
     }
 
     func update(artist: VLCMLArtist) {
+        thumbnailView.layer.masksToBounds = true
         thumbnailView.layer.cornerRadius = thumbnailView.frame.size.width / 2.0
         titleLabel.text = artist.name
         descriptionLabel.text = artist.numberOfTracksString()

+ 3 - 0
Sources/MediaEditCell.swift

@@ -75,12 +75,14 @@ class MediaEditCell: BaseCollectionViewCell {
         if audio.isThumbnailGenerated() {
             thumbnailImageView.image = UIImage(contentsOfFile: audio.thumbnail.path)
         }
+        thumbnailImageView.layer.masksToBounds = true
         thumbnailImageView.layer.cornerRadius = thumbnailImageView.frame.size.height / 2
     }
 
     func updateForArtist(artist: VLCMLArtist) {
         //TODO: add size, number of tracks, thumbnail
         titleLabel.text = artist.name
+        thumbnailImageView.layer.masksToBounds = true
         thumbnailImageView.layer.cornerRadius = thumbnailImageView.frame.size.height / 2
     }
 
@@ -93,6 +95,7 @@ class MediaEditCell: BaseCollectionViewCell {
     func updateForGenre(genre: VLCMLGenre) {
         titleLabel.text = genre.name
         timeLabel.text = genre.numberOfTracksString()
+        thumbnailImageView.layer.masksToBounds = true
         thumbnailImageView.layer.cornerRadius = thumbnailImageView.frame.size.height / 2
         //TODO: add thumbnail
     }