-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
iOS/issue-tracker/issue-tracker/Controller/IssueToolbar.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |