Skip to content

Commit

Permalink
#8 feat: RingtoneViewCell 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
sanghyeok-kim committed Aug 3, 2023
1 parent 4749869 commit 175373e
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// RingtoneViewCell.swift
// Multimer
//
// Created by 김상혁 on 2023/08/02.
//

import UIKit

final class RingtoneViewCell: UITableViewCell, CellIdentifiable {

private let titleLabel = UILabel()

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
layoutUI()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func configure(title: String, isSelected: Bool) {
titleLabel.text = title
accessoryType = isSelected ? .checkmark : .none
}

func toggleSelection() {
accessoryType = isSelected ? .none : .checkmark
}
}

// MARK: - UI Layout

private extension RingtoneViewCell {
func layoutUI() {
contentView.addSubview(titleLabel)

titleLabel.translatesAutoresizingMaskIntoConstraints = false
titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16).isActive = true
titleLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
}
}

0 comments on commit 175373e

Please sign in to comment.