Skip to content

Commit

Permalink
[Fix] #289 - 가격 에러일 때만 deleteMenuAccessoryView 뜨도록 재수정
Browse files Browse the repository at this point in the history
  • Loading branch information
EunsuSeo01 committed Nov 15, 2024
1 parent eaab9a0 commit f14d99f
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class ModifyMenuTextField: UITextField {
private var isWarn: Bool = false {
didSet {
updateStyle()
toggleAccessoryViewVisibility(isDeleteHidden: !isWarn)
modifyMenuTextFieldDelegate?.showErrorLabel(isWarn: isWarn && isModifying)
}
}
Expand All @@ -45,7 +46,7 @@ final class ModifyMenuTextField: UITextField {
private lazy var enterMenuAccessoryView: EnterMenuAccessoryView = EnterMenuAccessoryView(titleText: titleText)
private lazy var deleteMenuAccessoryView: DeleteMenuAccessoryView = DeleteMenuAccessoryView(
deleteButtonAction: showDeleteAlert,
xButtonAction: hideAccessoryView
xButtonAction: hideDeleteMenuAccessoryView
)

// MARK: - Init
Expand Down Expand Up @@ -182,9 +183,6 @@ private extension ModifyMenuTextField {
layer.borderWidth = isWarn && isModifying ? 1 : 0
layer.borderColor = isWarn && isModifying ? UIColor.warnRed.cgColor : nil
textColor = isWarn ? .warnRed : .gray850

deleteMenuAccessoryView.isHidden = !isWarn
enterMenuAccessoryView.isHidden = isWarn
}

func setupInputAccessoryView() {
Expand All @@ -204,9 +202,13 @@ private extension ModifyMenuTextField {
inputAccessoryView = accessoryView
}

func hideAccessoryView() {
deleteMenuAccessoryView.isHidden = true
enterMenuAccessoryView.isHidden = false
func toggleAccessoryViewVisibility(isDeleteHidden: Bool) {
deleteMenuAccessoryView.isHidden = isDeleteHidden
enterMenuAccessoryView.isHidden = !isDeleteHidden
}

func hideDeleteMenuAccessoryView() {
toggleAccessoryViewVisibility(isDeleteHidden: true)
}

func showDeleteAlert() {
Expand Down

0 comments on commit f14d99f

Please sign in to comment.