git.iko.soy/dashared/GDproject
on master help sign in
improved hashtag styling, finished profile
commitdf5de7cf2aa4912ecc3373dda02e66c21d7f45c8 authorDarya Rednikina <rednikina.com@yandex.ru> dateSun 17 Feb 2019, 12:50 (8 years ago) parent0586c41
2 files changed+30−17
GDproject/Controller/News/FullPostController.swift+14−5 GDproject/Controller/News/PostViewCell.swift+16−12
GDproject/Controller/News/FullPostController.swift+14−5
@@ -20,6 +20,8 @@ class FullPostController: UITableViewController {
2020
2121 setUpNavigationBar()
2222 tableView.separatorStyle = .none
23+
24+
2325 }
2426
2527 func setUpNavigationBar(){
@@ -53,16 +55,23 @@ class FullPostController: UITableViewController {
5355 }
5456
5557
56−// override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
57−// {
58−//
59−// }
58+ override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
59+ {
60+ switch section {
61+ case 0:
62+ let v = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 1))
63+ v.backgroundColor = .white
64+ return v
65+ default:
66+ return nil
67+ }
68+ }
6069
6170
6271 override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
6372 switch section {
6473 case 0:
65− return 50
74+ return 1
6675 default:
6776 return 0
6877 }
GDproject/Controller/News/PostViewCell.swift+16−12
@@ -101,7 +101,7 @@ class PostViewCell: UITableViewCell
101101 //nameStackView.height(46)
102102 nameStackView.edgesToSuperview(excluding: .bottom, insets: .left(20) + .right(20) + .top(8))
103103
104− let mainView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
104+ let mainView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 30))
105105
106106 let scrollView = UIScrollView()
107107
@@ -116,10 +116,10 @@ class PostViewCell: UITableViewCell
116116 for hash in post!.hashtags {
117117 let button = UIButton()
118118 button.setTitle("#" + hash, for: .normal)
119− button.backgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
120− button.layer.cornerRadius = 10
121− button.titleLabel?.font = UIFont.systemFont(ofSize: 14)
122− button.setTitleColor(.black, for: .normal)
119+ //button.backgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
120+ //button.layer.cornerRadius = 10
121+ button.titleLabel?.font = UIFont.monospacedDigitSystemFont(ofSize: 15, weight: .semibold)
122+ button.setTitleColor(#colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), for: .normal)
123123 buttons.append(button)
124124 }
125125
@@ -128,18 +128,22 @@ class PostViewCell: UITableViewCell
128128 scrollView.addSubview(stackViewHashTags)
129129
130130 stackViewHashTags.axis = .horizontal
131− stackViewHashTags.alignment = .center
132− stackViewHashTags.spacing = 20
131+ stackViewHashTags.spacing = 17
133132
134− stackViewHashTags.edgesToSuperview(insets: .left(20) + .top(10) + .right(20))
133+ // edgesToSuperview(insets: .left(20) + .top(10) + .right(20))
134+ stackViewHashTags.horizontalToSuperview(insets: .left(20) + .right(20))
135+ stackViewHashTags.verticalToSuperview()
135136
136− scrollView.contentSize = CGSize(width: 500, height: 50)
137+ stackViewHashTags.distribution = .fillProportionally
138+ stackViewHashTags.alignment = .center
139+
140+ scrollView.contentSize = CGSize(width: 500, height: 30)
137141
138142
139143 contentView.addSubview(mainView)
140144 mainView.edgesToSuperview(excluding: [.top, .bottom])
141− mainView.topToBottom(of: nameStackView)
142− mainView.height(50)
145+ mainView.topToBottom(of: nameStackView, offset: 5)
146+ mainView.height(30)
143147
144148 let stackView = MyStackView(arrangedSubviews: views)
145149 stackView.isFull = full
@@ -148,7 +152,7 @@ class PostViewCell: UITableViewCell
148152 if !full {
149153 stackView.height(300, relation: .equalOrLess, isActive: true)
150154 }
151− stackView.topToBottom(of: mainView, offset: 16, relation: .equal, isActive: true)
155+ stackView.topToBottom(of: mainView, offset: 0, relation: .equal, isActive: true)
152156 stackView.edgesToSuperview(excluding: [.top, .bottom], insets: .left(16) + .right(16))
153157
154158 let commentsSharesStackView = UIStackView(arrangedSubviews: [ commentsLabel, shareButton])