-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstagramFeedCellController.swift
110 lines (89 loc) · 4.32 KB
/
InstagramFeedCellController.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
102
103
104
105
106
107
108
109
110
//
// InstagramFeedCellController.swift
// comblie
//
// Created by Cal on 10/24/15.
// Copyright © 2015 Comblie. All rights reserved.
//
import UIKit
class InstagramFeedCellController: UITableViewCell {
@IBOutlet weak var postBackgroundImage: UIImageView!
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var postText: UILabel!
@IBOutlet weak var statusText: UILabel!
@IBOutlet weak var lineSeparator: UIView!
@IBOutlet weak var lineHeight: NSLayoutConstraint!
@IBOutlet weak var playButton: UIButton!
@IBOutlet weak var likeCommentBox: UIStackView!
@IBOutlet weak var postTime: UILabel!
var VC : InstagramModalController!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.postBackgroundImage.image = UIImage(named: "sunset")
self.profileImage.layer.cornerRadius = CGFloat(self.profileImage.frame.height/2)
configureText()
lineHeight.constant = CGFloat(0.5)
self.selectionStyle = UITableViewCellSelectionStyle.None
}
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()
}
// MARK: Action
@IBAction func enlarge(sender: UIButton) {
VC = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("InstagramModal") as! InstagramModalController
//For keeping the opacity
VC.providesPresentationContextTransitionStyle = true
VC.definesPresentationContext = true
VC.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext
self.window?.rootViewController?.presentViewController(VC, animated: true, completion: setModal)
}
@IBAction func playVideo(sender: UIButton) {
print("Playing Video")
}
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.postHeight = self.contentView.frame.height
//VC.playButton.setBackgroundImage(UIImage(named: "playArrow"), forState: .Normal)
}
func configureText() {
var user = "@davidbeckham "
var userMutableString = NSMutableAttributedString()
userMutableString = NSMutableAttributedString(string: user, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
var sectionOne = "posted a photo on "
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 = "Instagram"
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
}
}