-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#3/view set up
- Loading branch information
Showing
181 changed files
with
14,292 additions
and
709 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,36 @@ | ||
// | ||
// Alert.swift | ||
// KNU_CSE | ||
// | ||
// Created by junseok on 2021/07/17. | ||
// | ||
|
||
import UIKit | ||
|
||
struct Alert{ | ||
var alert : UIAlertController | ||
var title : String | ||
var message : String | ||
var viewController : UIViewController | ||
|
||
init(title:String, message:String, viewController:UIViewController) { | ||
self.title = title | ||
self.message = message | ||
self.alert = UIAlertController(title: title, message: message, preferredStyle: .alert) | ||
self.viewController = viewController | ||
} | ||
|
||
func popUpDefaultAlert(action:((UIAlertAction)->())?){ | ||
let actionDefault = UIAlertAction(title: "확인", style: .default,handler: action) | ||
self.alert.addAction(actionDefault) | ||
self.viewController.present(alert, animated: true, completion: nil) | ||
} | ||
|
||
func popUpNormalAlert(action:((UIAlertAction)->())?){ | ||
let actionCancel = UIAlertAction(title: "취소", style: .destructive, handler: nil) | ||
let actionDefault = UIAlertAction(title: "확인", style: .default,handler: action) | ||
self.alert.addAction(actionCancel) | ||
self.alert.addAction(actionDefault) | ||
self.viewController.present(alert, animated: true, completion: nil) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
KNU_CSE/KNU_CSE/Custom/Cell/BoardTitleCollectionCell.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,66 @@ | ||
// | ||
// BoardTitleCell.swift | ||
// KNU_CSE | ||
// | ||
// Created by junseok on 2021/07/21. | ||
// | ||
|
||
import UIKit | ||
|
||
class BoardTitleCell : UICollectionViewCell { | ||
var titleLabel = UILabel() | ||
static let identifier = "BoardTitleCell" | ||
|
||
override var isSelected: Bool { | ||
willSet { | ||
if newValue { | ||
titleLabel.textColor = .black | ||
} else { | ||
titleLabel.textColor = .lightGray | ||
} | ||
} | ||
} | ||
|
||
override func prepareForReuse() { | ||
//isSelected = false | ||
} | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
draw() | ||
self.isSelected = false | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func draw(){ | ||
initUI() | ||
addView() | ||
setUpConstraints() | ||
} | ||
|
||
func initUI(){ | ||
|
||
} | ||
|
||
func addView(){ | ||
self.contentView.addSubview(titleLabel) | ||
} | ||
|
||
func setUpConstraints(){ | ||
titleLabel.snp.makeConstraints{ make in | ||
make.width.equalToSuperview() | ||
make.height.equalToSuperview() | ||
} | ||
} | ||
} | ||
|
||
extension BoardTitleCell{ | ||
func setTitle(title: String) { | ||
titleLabel.text = title | ||
titleLabel.textAlignment = .center | ||
titleLabel.font = UIFont.systemFont(ofSize: 15, weight: .semibold) | ||
} | ||
} |
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,55 @@ | ||
// | ||
// SeatReservationCell.swift | ||
// KNU_CSE | ||
// | ||
// Created by junseok on 2021/07/18. | ||
// | ||
|
||
import UIKit | ||
import SnapKit | ||
|
||
class ClassRoomCell : UITableViewCell { | ||
static let identifier = "ClassRoomCell" | ||
var titleLabel = UILabel() | ||
|
||
var action :()->() = {} | ||
|
||
var classRoom : ClassRoom!{ | ||
didSet{ | ||
let title = "\(classRoom.building)-\(classRoom.roomNum)호(\(classRoom.currentSeat)/\(classRoom.totalSeat))" | ||
self.setTitle(title: title) | ||
} | ||
} | ||
|
||
func setTitle(title: String) { | ||
titleLabel.text = title | ||
titleLabel.textAlignment = .center | ||
} | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
self.initUI() | ||
self.addView() | ||
self.setUpConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func initUI(){ | ||
|
||
} | ||
|
||
func addView(){ | ||
self.contentView.addSubview(titleLabel) | ||
} | ||
|
||
func setUpConstraints(){ | ||
|
||
titleLabel.snp.makeConstraints{ make in | ||
make.width.equalToSuperview() | ||
make.height.equalToSuperview() | ||
} | ||
} | ||
} |
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,89 @@ | ||
// | ||
// ClassSeatCell.swift | ||
// KNU_CSE | ||
// | ||
// Created by junseok on 2021/07/19. | ||
// | ||
|
||
import UIKit | ||
import SnapKit | ||
|
||
class ClassSeatCell:UICollectionViewCell{ | ||
static let identifier = "ClassSeatCell" | ||
var action:()->() = {} | ||
var _classSeat:ClassSeat! | ||
|
||
var classSeat: ClassSeat{ | ||
get{ | ||
return _classSeat | ||
}set(newValue){ | ||
_classSeat = newValue | ||
self.isUsable = newValue.status | ||
self.seatBtn.setTitle(String(self.classSeat.seatNumber), for: .normal) | ||
} | ||
} | ||
|
||
var seatBtn:UIButton!{ | ||
didSet{ | ||
seatBtn.layer.cornerRadius = 10 | ||
} | ||
} | ||
|
||
var _isUsable : Bool! | ||
var isUsable : Bool{ | ||
get{ | ||
return _isUsable | ||
}set(newValue){ | ||
_isUsable = newValue | ||
if _isUsable{ | ||
setUsable() | ||
}else{ | ||
setUnUsable() | ||
} | ||
} | ||
} | ||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
draw() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func draw(){ | ||
initUI() | ||
addView() | ||
setUpConstraints() | ||
} | ||
|
||
func initUI(){ | ||
seatBtn = UIButton() | ||
} | ||
|
||
func addView(){ | ||
self.contentView.addSubview(seatBtn) | ||
} | ||
|
||
func setUpConstraints(){ | ||
seatBtn.snp.makeConstraints{ make in | ||
make.left.right.top.bottom.equalToSuperview() | ||
} | ||
} | ||
|
||
func setUsable(){ | ||
seatBtn.backgroundColor = Color.green | ||
seatBtn.setTitleColor(UIColor.init(white: 1, alpha: 0.3), for: .highlighted) | ||
seatBtn.addAction { | ||
self.action() | ||
} | ||
} | ||
|
||
func setUnUsable(){ | ||
seatBtn.backgroundColor = Color.gray | ||
} | ||
|
||
func setBtnAction(action:@escaping()->()){ | ||
self.action = action | ||
} | ||
} |
Oops, something went wrong.