-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: mainTableView의 Delegate 지정 (#8)
테이블 뷰와 delegate 연결 커스텀 헤더 지정
- Loading branch information
Showing
4 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
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
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,28 @@ | ||
// | ||
// MainTableViewDelegate.swift | ||
// sidedish | ||
// | ||
// Created by 박정하 on 2021/04/19. | ||
// | ||
|
||
import UIKit | ||
|
||
class MainTableViewDelegate : NSObject, UITableViewDelegate { | ||
|
||
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
let headerView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: tableView.frame.width, height: 32)) | ||
|
||
let label = UILabel() //나중에 별도의 유즈케이스를 처리할 프로토콜 필요할 거 같아요 | ||
label.frame = CGRect.init(x: 0, y: 0, width: headerView.frame.width, height: headerView.frame.height) | ||
label.text = "모두가 좋아하는 든든한 메인요리" | ||
label.font = .boldSystemFont(ofSize: 22) | ||
|
||
headerView.addSubview(label) | ||
|
||
return headerView | ||
} | ||
|
||
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
return 56 // headerView의 height(32) + figma에서 지정해 준 헤더와 셀 간의 간격! | ||
} | ||
} |
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