-
Notifications
You must be signed in to change notification settings - Fork 0
/
VineFeedCellController.swift
101 lines (81 loc) · 3.92 KB
/
VineFeedCellController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// VineFeedCellController.swift
// comblie
//
// Created by Cal on 10/24/15.
// Copyright © 2015 Comblie. All rights reserved.
//
import UIKit
class VineFeedCellController: UITableViewCell {
@IBOutlet weak var postBackgroundImage: UIImageView!
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var postText: UILabel!
@IBOutlet weak var statusText: UILabel!
@IBOutlet weak var lineHeight: NSLayoutConstraint!
@IBOutlet weak var lineSeparator: UIView!
@IBOutlet weak var postedTime: UILabel!
var VC : VineVideoModalController!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.profileImage.layer.cornerRadius = CGFloat(self.profileImage.frame.height/2)
configureText()
lineHeight.constant = CGFloat(0.5)
}
//MARK: Actions
@IBAction func enlarge(sender: UIButton) {
VC = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("VineModal") as! VineVideoModalController
//For keeping the opacity
VC.providesPresentationContextTransitionStyle = true
VC.definesPresentationContext = true
VC.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext
self.window?.rootViewController?.presentViewController(VC, animated: true, completion: setModal)
}
func setModal() {
VC.thumbnailImage.image = self.postBackgroundImage.image
VC.profileImage.image = self.profileImage.image
VC.postText.text = self.postText.text
VC.statusText.attributedText = self.statusText.attributedText
VC.playButton.setBackgroundImage(UIImage(named: "playArrow"), forState: .Normal)
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
lineSeparator.backgroundColor = UIColor.whiteColor()
// Configure the view for the selected state
}
override func setHighlighted(highlighted: Bool, animated: Bool) {
lineSeparator.backgroundColor = UIColor.whiteColor()
}
func configureText() {
var user = "Jaden Smith "
var userMutableString = NSMutableAttributedString()
userMutableString = NSMutableAttributedString(string: user, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
var sectionOne = "revined "
var sectionOneMutableString = NSMutableAttributedString()
sectionOneMutableString = NSMutableAttributedString(string: sectionOne, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Lt",
size: 10.0)!])
var author = "David"
var authorMutableString = NSMutableAttributedString()
authorMutableString = NSMutableAttributedString(string: author, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
var sectionTwo = "'s post on "
var sectionTwoMutableString = NSMutableAttributedString()
sectionTwoMutableString = NSMutableAttributedString(string: sectionTwo, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Lt",
size: 10.0)!])
var network = "Vine"
var networkMutableString = NSMutableAttributedString()
networkMutableString = NSMutableAttributedString(string: network, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
userMutableString.appendAttributedString(sectionOneMutableString)
userMutableString.appendAttributedString(authorMutableString)
userMutableString.appendAttributedString(sectionTwoMutableString)
userMutableString.appendAttributedString(networkMutableString)
statusText.attributedText = userMutableString
}
}