Skip to content

Commit

Permalink
feat: ✨ IssueToolbar 구현 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
zekexros committed Jun 11, 2021
1 parent d07f51c commit 315f4db
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions iOS/issue-tracker/issue-tracker/Controller/IssueToolbar.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// IssueToolbar.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/11.
//

import UIKit

class IssueToolbar: UIToolbar {

let checkBoxBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.image = UIImage(systemName: "checkmark.circle")

return item
}()

let closeIssueBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.image = UIImage(systemName: "archivebox")
return item
}()

let labelBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.title = "이슈를 선택하세요"
item.isEnabled = false
return item
}()

let flexibleBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
return item
}()

override init(frame: CGRect) {
super.init(frame: frame)
setToolbar()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
setToolbar()
}

func setToolbar() {
let items = [checkBoxBarButtonItem, flexibleBarButtonItem, labelBarButtonItem, flexibleBarButtonItem, closeIssueBarButtonItem]
setItems(items, animated: false)

}

func setCheckMode(count: Int) {
checkBoxBarButtonItem.image = UIImage(systemName: "checkmark.circle")
labelBarButtonItem.title = "\(count)개의 이슈가 선택됨"
labelBarButtonItem.tintColor = .black
}

func setUncheckMode() {
checkBoxBarButtonItem.image = UIImage(systemName: "checkmark.circle.fill")
labelBarButtonItem.title = "이슈를 선택하세요"
labelBarButtonItem.tintColor = .lightGray
}
}

0 comments on commit 315f4db

Please sign in to comment.