Skip to content

Feature recruit #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: develop_
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 203 additions & 9 deletions GetRestIOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>GetRestIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>6</integer>
</dict>
</dict>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>GetRestIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
<integer>8</integer>
</dict>
</dict>
</dict>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
Binary file not shown.
178 changes: 165 additions & 13 deletions GetRestIOS/Controllers/MainHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,183 @@
// Copyright © 2019 최리안. All rights reserved.
//

import UIKit
import UIKit
import ScrollableGraphView

class MainHomeViewController: UIViewController {

@IBOutlet weak var topSideView: UIView!
class MainHomeViewController: UIViewController {
var barPlotData: [Double] = [ 7, 4, 7, 6, 3, 7, 3, 4, 3, 2, 7, 4]
var xAxisLabels: [String] = ["1" ,"2","3", "4", "1" ,"2","3", "4", "1" ,"2","3", "4",]
var graphDetailList : [HomeGraphDetailModel] = [
// HomeGraphDetailModel("솝트", "2019.03 ~ 2019.07"),
// HomeGraphDetailModel("매디", "2018.01 ~ 2019.12"),
// HomeGraphDetailModel("매디", "2018.01 ~ 2019.12"),
// HomeGraphDetailModel("매디", "2018.01 ~ 2019.12"),
// HomeGraphDetailModel("매디", "2018.01 ~ 2019.12")
]

@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var topSideView: UIImageView!
@IBOutlet weak var topSideLabel: UILabel!
@IBOutlet weak var graphView: UIView!
@IBOutlet weak var graphDetailTableView: UITableView!
@IBOutlet weak var firstSectionView: UIView!
@IBOutlet weak var secondSectionView: UIView!


var scrollViewContentHeight = 1200 as CGFloat
let navigationBarHeight = 64 as CGFloat
var tableCellHeight = 64 as CGFloat
var tableHeight = 1000 as CGFloat

var username: String = "박경선"

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.mainBackgroudGray
setTableView()
setTopSideView()
setGraph(containerView: graphView)
graphDetailTableView.reloadData()
let attributedString = NSMutableAttributedString()
.bold(username, fontSize: 23)
.normal("님의 \n기록을 살펴 볼까요?", fontSize: 23)
topSideLabel.attributedText = attributedString
firstSectionView.dropShadow(color: UIColor.shadow, offSet: CGSize.zero, opacity: 1.0, radius: 5)
secondSectionView.dropShadow(color: UIColor.shadow, offSet: CGSize.zero, opacity: 1.0, radius: 5)
}

func setTableView() {
self.graphDetailTableView.delegate = self
self.graphDetailTableView.dataSource = self
// self.graphDetailTableView.estimatedRowHeight = tableCellHeight
// self.graphDetailTableView.rowHeight = UITableView.automaticDimension
self.graphDetailTableView.backgroundColor = UIColor.white
self.graphDetailTableView.separatorColor = UIColor.mainBackgroudGray
self.graphDetailTableView.alwaysBounceVertical = false
// self.graphDetailTableView.isScrollEnabled = false

}

override func viewWillAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setNavigationBar()
}
func setNavigationBar(){
navigationController?.navigationBar.barTintColor = UIColor.mainGreen
// 불투명하게 만들기
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.setBackgroundImage(UIImage(named: "navigationBarWithLogo"), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()

topSideView.backgroundColor = UIColor.mainGreen
}

func setTopSideView(){
topSideView.backgroundColor = UIColor(patternImage: UIImage(named: "homeTopSideViewImg")!)
topSideView.roundCorners(corners: [.bottomLeft, .bottomRight], radius: 28)

// Do any additional setup after loading the view.

topSideLabel.text = "\(username)님의\n기록을 살펴볼까요?"
topSideLabel.numberOfLines = 0
}

func attributedText(withString string: String, boldString: String, font: UIFont) -> String {
let attributedString = NSMutableAttributedString(string: string, attributes: [NSAttributedString.Key.font: font])
let boldFontAttribute: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: font.pointSize)]
let range = (string as NSString).range(of: boldString)
attributedString.addAttributes(boldFontAttribute, range: range)
return attributedString.string
}
}

/*
// MARK: - Navigation
extension MainHomeViewController : ScrollableGraphViewDataSource {
func value(forPlot plot: Plot, atIndex pointIndex: Int) -> Double {
return barPlotData[pointIndex]
}

func label(atIndex pointIndex: Int) -> String {
return xAxisLabels[pointIndex]
}

func numberOfPoints() -> Int {
return xAxisLabels.count
}

func setGraph(containerView: UIView) {
drawReferenceLine(containerView)
let frame : CGRect = CGRect(x: 0,
y: 0,
width: self.graphView.frame.width,
height: self.graphView.frame.height)
let barGraphView = ScrollableGraphView(frame: frame, dataSource: self)
let barPlot = BarPlot(identifier: "bar")

barPlot.barWidth = 12
barPlot.barLineWidth = 0
barPlot.barColor = UIColor.graphBarGray

// barPlot.adaptAnimationType = ScrollableGraphViewAnimationType.elastic
// barPlot.animationDuration = 1.5
barGraphView.topMargin = 0
barGraphView.bottomMargin = 16
barGraphView.dataPointSpacing = 27

barGraphView.leftmostPointPadding = 20
let referenceLines = ReferenceLines()

// referenceLines.referenceLineLabelFont = UIFont.boldSystemFont(ofSize: 7)
referenceLines.dataPointLabelFont = UIFont.systemFont(ofSize: 14)
referenceLines.referenceLineColor = UIColor.graphLineGray
referenceLines.referenceLineLabelColor = UIColor.mainColorBlue
referenceLines.dataPointLabelColor = UIColor.mainColorBlue
// referenceLines.shouldShowReferenceLines = false
referenceLines.shouldAddLabelsToIntermediateReferenceLines = false
referenceLines.shouldAddUnitsToIntermediateReferenceLineLabels = false

barGraphView.backgroundFillColor = UIColor.graphBackgroundWhite
barGraphView.shouldAnimateOnStartup = false

barGraphView.rangeMax = barPlotData.max()!
barGraphView.rangeMin = 0

barGraphView.addReferenceLines(referenceLines: referenceLines)
barGraphView.addPlot(plot: barPlot)

containerView.addSubview(barGraphView)
}

func drawReferenceLine(_ containerView: UIView){
}
}

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
extension MainHomeViewController : UITableViewDataSource, UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return graphDetailList.count
}
*/
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "graphDetailTableViewCell") as! HomeGraphDetailTableViewCell
cell.contentView.backgroundColor = UIColor.white
cell.portfolioTitle?.text = graphDetailList[indexPath.row].portfolioTitle!
cell.portfolioDuration?.text = graphDetailList[indexPath.row].portfolioDuration!
return cell
}
}

extension NSMutableAttributedString {

func bold(_ text: String, fontSize: CGFloat) -> NSMutableAttributedString {
let attrs: [NSAttributedString.Key: Any] = [.font: UIFont.boldSystemFont(ofSize: fontSize)]
self.append(NSMutableAttributedString(string: text, attributes: attrs))
return self
}

func normal(_ text: String, fontSize: CGFloat) -> NSMutableAttributedString {
let attrs: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: fontSize)]
self.append(NSMutableAttributedString(string: text, attributes: attrs))
return self
}
}


43 changes: 43 additions & 0 deletions GetRestIOS/Controllers/Portfolio/AddPortfolioViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// AddPortfolioViewController.swift
// GetRestIOS
//
// Created by 최리안 on 06/07/2019.
// Copyright © 2019 최리안. All rights reserved. ㄴㄴ
//

import UIKit

class AddPortfolioViewController: UIViewController {

@IBOutlet var categoryLabel: UILabel!
@IBOutlet var cateBtnClick: UIView!
// var label: String = ""

override func viewDidLoad() {
super.viewDidLoad()


let gesture = UITapGestureRecognizer(target: self, action: #selector(AddPortfolioViewController.goCategory(sender:)))
self.cateBtnClick.addGestureRecognizer(gesture)
// categoryLabel.text = "카테고리??"
NotificationCenter.default.addObserver(forName: .CategoryData, object: nil, queue: OperationQueue.main) { (notification) in
let dateVc = notification.object as! CategoryVC
self.categoryLabel.text = dateVc.CategoryLabel
}
}

@objc func goCategory(sender:UIGestureRecognizer) {

let storyboard = UIStoryboard(name: "Portfolio", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "CategoryVC")
// let vc = storyboard?.instantiateViewController(withIdentifier: "CategoryVC") as! CategoryVC
self.present(vc, animated: true)

}





}
30 changes: 30 additions & 0 deletions GetRestIOS/Controllers/Portfolio/CategoryCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// CategoryCell.swift
// GetRestIOS
//
// Created by 최리안 on 11/07/2019.
// Copyright © 2019 최리안. All rights reserved.
//

import UIKit

class CategoryCell: UITableViewCell {

@IBOutlet var cellBackground: UIView!
@IBOutlet var cateLabel: UILabel!
@IBOutlet var bottomLine: UIView!
var isChceked = false

override func awakeFromNib() {
super.awakeFromNib()
bottomLine.backgroundColor = .bottomGray
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}
95 changes: 95 additions & 0 deletions GetRestIOS/Controllers/Portfolio/CategoryVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// CategoryVC.swift
// GetRestIOS
//
// Created by 최리안 on 11/07/2019.
// Copyright © 2019 최리안. All rights reserved.
//

import UIKit

class CategoryVC: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet var backBtnView: UIView!
@IBOutlet var cateTV: UITableView!
var cate: [String] = ["대외활동", "학교활동", "공모전", "경력사항", "기타"]
var selectCate: Int = 10
var selectCateIndex: IndexPath = []
var CategoryLabel: String = ""
var ll: String = ""

override func viewDidLoad() {
super.viewDidLoad()

cateTV.delegate = self
cateTV.dataSource = self
let gesture = UITapGestureRecognizer(target: self, action: #selector(CategoryVC.goBack(sender:)))
self.backBtnView.addGestureRecognizer(gesture)
}

@objc func goBack(sender:UIGestureRecognizer) {
// let storyboard = UIStoryboard(name: "Portfolio", bundle: nil)
// let dvc = storyboard.instantiateViewController(withIdentifier: "AddPortfolioViewController") as! AddPortfolioViewController
if selectCate == 10 {
CategoryLabel = "카테고리"
} else {
CategoryLabel = cate[selectCate]
}
NotificationCenter.default.post(name: .CategoryData, object: self)
dismiss(animated: true)
}


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cate.count
}


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CategoryCell", for: indexPath) as! CategoryCell

cell.cateLabel.text = cate[indexPath.row]

if ll == self.cate[indexPath.row] {
cell.isChceked = true
cell.cateLabel.textColor = .white
cell.backgroundColor = .barMainGreen
}

return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

let cell = tableView.cellForRow(at: indexPath) as! CategoryCell

if cell.isChceked {
print("off")
cell.cateLabel.textColor = .btnBarItemTitleColor
cell.backgroundColor = .white
cell.isChceked = false
selectCate = 10

}
else {
if (selectCate != indexPath.row) && (selectCate != 10) {
let cell_ = tableView.cellForRow(at: selectCateIndex) as! CategoryCell
cell_.cateLabel.textColor = .btnBarItemTitleColor
cell_.backgroundColor = .white
cell_.isChceked = false

cell.isChceked = true
cell.cateLabel.textColor = .white
cell.backgroundColor = .barMainGreen
} else {
cell.isChceked = true
cell.cateLabel.textColor = .white
cell.backgroundColor = .barMainGreen
}
print("on")
selectCateIndex = indexPath
selectCate = indexPath.row
cell.isChceked = true
}
}

}
Loading