Skip to content

Commit

Permalink
[Feat] Runnect#139 - 이전 제목과 같은 text 입력 시 완료 버튼 끄기
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwogus0128 committed May 13, 2023
1 parent 6ac9775 commit fe4b89f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class ActivityRecordDetailVC: UIViewController {

private let courseTitleTextField = UITextField().then {
$0.attributedPlaceholder = NSAttributedString(
string: String(),
string: "글 제목",
attributes: [.font: UIFont.h4, .foregroundColor: UIColor.g3]
)
$0.font = .h4
Expand Down Expand Up @@ -103,6 +103,7 @@ final class ActivityRecordDetailVC: UIViewController {

private lazy var finishEditButton = CustomButton(title: "완료").then {
$0.isHidden = true
$0.isEnabled = false
}

// MARK: - View Life Cycle
Expand Down Expand Up @@ -148,6 +149,10 @@ extension ActivityRecordDetailVC {

self.finishEditButton.isEnabled = !text.isEmpty

if text == self.courseTitleLabel.text {
self.finishEditButton.isEnabled = false
}

if text.count > courseTitleMaxLength {
let index = text.index(text.startIndex, offsetBy: courseTitleMaxLength)
let newString = text[text.startIndex..<index]
Expand Down Expand Up @@ -418,7 +423,7 @@ extension ActivityRecordDetailVC {
make.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(22)
make.centerX.equalToSuperview()
}

middleScorollView.addSubview(finishEditButton)

finishEditButton.snp.makeConstraints { make in
Expand Down Expand Up @@ -461,6 +466,4 @@ extension ActivityRecordDetailVC {
}
}
}


}

0 comments on commit fe4b89f

Please sign in to comment.